fix: duplicate errors, create cleanup, forge profile, neoforge filter
This commit is contained in:
1 parent
abacb830bc
commit
a016682eda
6 files changed
+95
-12
No files matched your search
@@ -0,0 +1,14 @@
|
||||
JVM info: Arch Linux - 21.0.10 - 21.0.10+7
|
||||
java.net.preferIPv4Stack=true
|
||||
Current Time: 06/04/2026 11:22:00
|
||||
Host: files.minecraftforge.net [104.21.58.163, 172.67.161.211]
|
||||
Host: maven.minecraftforge.net [172.67.161.211, 104.21.58.163]
|
||||
Host: libraries.minecraft.net [150.171.109.101]
|
||||
Host: launchermeta.mojang.com [150.171.109.101]
|
||||
Host: piston-meta.mojang.com [150.171.109.101]
|
||||
Host: sessionserver.mojang.com [150.171.109.100]
|
||||
Host: authserver.mojang.com [Unknown]
|
||||
Target Directory: /home/consti/.local/share/mcl/instances/sfsdfd/.minecraft
|
||||
Data kindly mirrored by CreeperHost at https://www.creeperhost.net/
|
||||
There is no Minecraft launcher profile in "/home/consti/.local/share/mcl/instances/sfsdfd/.minecraft", you need to run the launcher first!
|
||||
There was an error during installation
|
||||
@@ -0,0 +1,12 @@
|
||||
JVM info: Arch Linux - 21.0.10 - 21.0.10+7
|
||||
java.net.preferIPv4Stack=true
|
||||
Current Time: 06/04/2026 11:21:32
|
||||
Host: maven.neoforged.net [37.19.194.80, 195.181.175.40, 212.102.56.178, 195.181.170.19, 79.127.216.203, 79.127.211.90]
|
||||
Host: libraries.minecraft.net [150.171.109.100]
|
||||
Host: launchermeta.mojang.com [150.171.109.100]
|
||||
Host: piston-meta.mojang.com [150.171.109.100]
|
||||
Host: sessionserver.mojang.com [150.171.109.101]
|
||||
Found java version 21.0.10
|
||||
Target Directory: /home/consti/.local/share/mcl/instances/test/.minecraft
|
||||
There is no minecraft launcher profile in "/home/consti/.local/share/mcl/instances/test/.minecraft", you need to run the launcher first!
|
||||
There was an error during installation
|
||||
+64
-1
@@ -52,12 +52,64 @@ impl InstanceManager {
|
||||
}
|
||||
|
||||
let instance_dir = self.instances_dir.join(name);
|
||||
let instance_json = instance_dir.join("instance.json");
|
||||
|
||||
if instance_dir.exists() {
|
||||
if instance_json.exists() {
|
||||
tracing::error!("Instance '{}' already exists", name);
|
||||
return Err(InstanceError::AlreadyExists(name.to_string()));
|
||||
}
|
||||
|
||||
if instance_dir.exists() && !instance_json.exists() {
|
||||
match std::fs::remove_dir_all(&instance_dir) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
tracing::error!(
|
||||
"Failed to remove partial instance directory '{}': {}",
|
||||
instance_dir.display(),
|
||||
e
|
||||
);
|
||||
return Err(InstanceError::Io(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
match std::fs::create_dir_all(&instance_dir) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to create instance directory: {}", e);
|
||||
return Err(InstanceError::Io(e));
|
||||
}
|
||||
}
|
||||
|
||||
let result = self
|
||||
.create_inner(name, game_version, loader, loader_version, &instance_dir)
|
||||
.await;
|
||||
|
||||
if result.is_err() {
|
||||
match std::fs::remove_dir_all(&instance_dir) {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
"Failed to clean up partial instance directory '{}': {}",
|
||||
instance_dir.display(),
|
||||
e
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
async fn create_inner(
|
||||
&self,
|
||||
name: &str,
|
||||
game_version: &str,
|
||||
loader: ModLoader,
|
||||
loader_version: Option<&str>,
|
||||
instance_dir: &std::path::Path,
|
||||
) -> Result<InstanceConfig, InstanceError> {
|
||||
|
||||
let minecraft_dir = instance_dir.join(".minecraft");
|
||||
for subdir in &["mods", "config", "resourcepacks", "shaderpacks", "saves"] {
|
||||
match std::fs::create_dir_all(minecraft_dir.join(subdir)) {
|
||||
@@ -69,6 +121,17 @@ impl InstanceManager {
|
||||
}
|
||||
}
|
||||
|
||||
let launcher_profiles_path = minecraft_dir.join("launcher_profiles.json");
|
||||
if !launcher_profiles_path.exists() {
|
||||
match std::fs::write(&launcher_profiles_path, "{}") {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to create launcher_profiles.json: {}", e);
|
||||
return Err(InstanceError::Io(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for meta_subdir in &[
|
||||
self.meta_dir.join("versions"),
|
||||
self.meta_dir.join("libraries"),
|
||||
|
||||
+4
-2
@@ -23,9 +23,11 @@ fn game_version_to_neoforge_prefix(game_version: &str) -> Option<String> {
|
||||
let parts: Vec<&str> = game_version.split('.').collect();
|
||||
match parts.as_slice() {
|
||||
// "1.21" → prefix "21.0."
|
||||
[_major, minor] => Some(format!("{}.0.", minor)),
|
||||
["1", minor] => Some(format!("{}.0.", minor)),
|
||||
// "1.20.4" → prefix "20.4."
|
||||
[_major, minor, patch] => Some(format!("{}.{}.", minor, patch)),
|
||||
["1", minor, patch] => Some(format!("{}.{}.", minor, patch)),
|
||||
[major, minor] => Some(format!("{}.{}.", major, minor)),
|
||||
[major, minor, _patch] => Some(format!("{}.{}.", major, minor)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,6 @@ impl<S: Subscriber> Layer<S> for StatusLayer {
|
||||
fn on_event(&self, event: &tracing::Event<'_>, _ctx: Context<'_, S>) {
|
||||
let level = *event.metadata().level();
|
||||
|
||||
if level > Level::INFO {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut visitor = MessageVisitor::default();
|
||||
event.record(&mut visitor);
|
||||
|
||||
|
||||
@@ -652,9 +652,7 @@ fn is_version_loader_compatible(version_id: &str, loader: ModLoader) -> bool {
|
||||
ModLoader::Fabric | ModLoader::Quilt => {
|
||||
major > 1 || (major == 1 && minor >= 14)
|
||||
}
|
||||
ModLoader::NeoForge => {
|
||||
major > 1 || (major == 1 && minor >= 20)
|
||||
}
|
||||
ModLoader::NeoForge => major == 1 && minor >= 20,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,7 +697,6 @@ fn ensure_versions_loaded(state: &mut WizardState) {
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to fetch MC versions: {}", e);
|
||||
match versions_arc.lock() {
|
||||
Ok(mut s) => {
|
||||
s.versions = LoadState::Error(e.to_string());
|
||||
@@ -734,7 +731,6 @@ fn ensure_loader_versions_loaded(state: &mut WizardState, loader: ModLoader, gam
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to fetch {} versions for {}: {}", loader, game_version, e);
|
||||
match versions_arc.lock() {
|
||||
Ok(mut s) => {
|
||||
s.loader_versions = LoadState::Error(e.to_string());
|
||||
|
||||
Reference in new issue
Block a user