Fixed paths

This commit is contained in:
Samuel Walker 2024-06-23 09:14:25 -07:00
parent 76b6cac979
commit 2bb85695c0

View File

@ -79,7 +79,7 @@ fn install_modpack(id: String){
ftp::ftp_retr(ftp_path, &mut file, |_| return).unwrap();
let mut child = Command::new(get_local_data_directory().join("prism").join(get_prism_executable())).arg("-I").arg(path).spawn().unwrap();
loop {
let version_path = get_data_directory().join("prism").join("instances").join(get_modpack_name(id.clone())).join(".minecraft").join("version.txt");
let version_path = get_local_data_directory().join("prism").join("instances").join(get_modpack_name(id.clone())).join(".minecraft").join("version.txt");
if version_path.clone().exists() {
let mut ver_file = File::open(version_path).unwrap();
let mut buf = String::new();
@ -112,14 +112,14 @@ fn install_modpack(id: String){
let mut set = false;
for line in buf.lines() {
if line.starts_with("JavaPath=") {
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(format!("JavaPath={}/java-{}-{}/bin/{}\n", get_local_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;
} else {
option_file.write_all(format!("{}\n",line).as_bytes());
}
}
if !set {
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(format!("JavaPath={}/java-{}-{}/bin/{}\n", get_local_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("OverrideJava=true\n".as_bytes());
}