fixed double java
This commit is contained in:
parent
917d2d7e7a
commit
216d9b68ee
@ -101,7 +101,8 @@ fn install_modpack(id: String){
|
|||||||
mc_version = component["version"].as_str().unwrap();
|
mc_version = component["version"].as_str().unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
java::install_java(get_java_version(mc_version));
|
let java = get_java_version(mc_version);
|
||||||
|
java::install_java(java);
|
||||||
|
|
||||||
let option_path = get_local_data_directory().join("prism").join("instances").join(get_modpack_name(id.clone())).join("instance.cfg");
|
let option_path = get_local_data_directory().join("prism").join("instances").join(get_modpack_name(id.clone())).join("instance.cfg");
|
||||||
let mut option_file = File::open(option_path.clone()).unwrap();
|
let mut option_file = File::open(option_path.clone()).unwrap();
|
||||||
@ -111,14 +112,14 @@ fn install_modpack(id: String){
|
|||||||
let mut set = false;
|
let mut set = false;
|
||||||
for line in buf.lines() {
|
for line in buf.lines() {
|
||||||
if line.starts_with("JavaPath=") {
|
if line.starts_with("JavaPath=") {
|
||||||
option_file.write_all(format!("JavaPath={}/java/java-{}/bin/{}\n", get_data_directory().join("java").into_os_string().to_str().unwrap().replace("\\", "/"), if env::consts::OS == "windows" {"win"} else {"lin"}, get_java_executable()).as_bytes());
|
option_file.write_all(format!("JavaPath={}/java-{}-{}/bin/{}\n", get_data_directory().join("java").into_os_string().to_str().unwrap().replace("\\", "/"), java, if env::consts::OS == "windows" {"win"} else {"lin"}, get_java_executable()).as_bytes());
|
||||||
set = true;
|
set = true;
|
||||||
} else {
|
} else {
|
||||||
option_file.write_all(format!("{}\n",line).as_bytes());
|
option_file.write_all(format!("{}\n",line).as_bytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !set {
|
if !set {
|
||||||
option_file.write_all(format!("JavaPath={}/java/java-{}/bin/{}\n", get_data_directory().join("java").into_os_string().to_str().unwrap().replace("\\", "/"), if env::consts::OS == "windows" {"win"} else {"lin"}, get_java_executable()).as_bytes());
|
option_file.write_all(format!("JavaPath={}/java-{}-{}/bin/{}\n", get_data_directory().join("java").into_os_string().to_str().unwrap().replace("\\", "/"), java, if env::consts::OS == "windows" {"win"} else {"lin"}, get_java_executable()).as_bytes());
|
||||||
option_file.write_all("OverrideJavaLocation=true\n".as_bytes());
|
option_file.write_all("OverrideJavaLocation=true\n".as_bytes());
|
||||||
option_file.write_all("OverrideJava=true\n".as_bytes());
|
option_file.write_all("OverrideJava=true\n".as_bytes());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user