1
0
Fork 0

readability and logging improvement

This commit is contained in:
Kim, Jimin 2022-01-27 08:40:57 +09:00
parent 5bed0e0df4
commit 1f04762124
2 changed files with 12 additions and 3 deletions

View file

@ -10,8 +10,10 @@ pub async fn install_bepinex(window: &Window, game_path: &str) -> Result<(), Ins
println!();
println!("Installing BepInEx");
//
// determine which BepInEx file to download
// download URL is updated manually
//
// latest release files can be found here: https://github.com/BepInEx/BepInEx/releases
let bepinex_zip_url = match env::consts::OS {
"linux" | "macos" => {
@ -28,18 +30,24 @@ pub async fn install_bepinex(window: &Window, game_path: &str) -> Result<(), Ins
}
};
//
// download file to cache directory
//
println!("Downloading BepInEx.zip");
match util::download_zip_to_cache_dir(bepinex_zip_url, "BepInEx.zip").await {
Ok(bepinex_path) => {
//
// unzip
//
println!("Downloaded BepInEx.zip to '{}'", bepinex_path);
println!("Unzipping BepInEx.zip");
match util::unzip(bepinex_path.as_str(), &game_path) {
Ok(()) => {
emit(&window, InstallSteps::InstallBepInEx);
Ok(_) => {
println!("Successfully unzipped BepInEx.zip to {}", game_path);
emit(&window, InstallSteps::InstallBepInEx);
}
Err(err) => {

View file

@ -82,6 +82,7 @@ pub async fn install(
"linux" | "macos" | "windows" => {}
_ => {
println!("Unsupported OS!");
return InstallResult::UnsupportedOS as i64;
}
}