Skip to content

Commit

Permalink
feat: clear misc files when switching
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed Apr 19, 2024
1 parent b6b3680 commit 52f00c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,6 @@ fn switch(ctx: &Context) {
.expect("Failed to save switcher config");
}

osu_util::clear_misc(&*osu_dir);
osu_util::restart_osu(&osu_exe, &server);
}
13 changes: 13 additions & 0 deletions src/osu_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,16 @@ pub fn restart_osu(osu_exe: &String, server: &String) {
.spawn()
.expect("Failed to start osu");
}

/// Clear miscellaneous files that might be an issue when relaunching
pub fn clear_misc(osu_dir: &str) {
// If this is present, it causes osu! to relaunch and repair itself, which doesn't preserve -devserver
let force_update_file = format!("{osu_dir}/.require_update");

// I have no clue what this contains, but I have heard about this potentially containing anti-multi-accounting
// data, which might interfere with switching accounts across servers. Just to be safe, wipe it regardless.
let osu_auth_logs = format!("{osu_dir}/Logs/osu!auth.log");

let _ = std::fs::remove_file(force_update_file.as_str());
let _ = std::fs::remove_file(osu_auth_logs.as_str());
}

0 comments on commit 52f00c9

Please sign in to comment.