Skip to content

Commit 4d90f8b

Browse files
Cleanup prefix for profile on deletion
1 parent ba477f5 commit 4d90f8b

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src-tauri/src/lib.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,9 +1296,28 @@ async fn delete_launch_profile(app_handle: tauri::AppHandle, uuid: Uuid) -> Comm
12961296
debug!("delete_launch_profile");
12971297
let internal = async {
12981298
let state = app_handle.state::<Mutex<AppState>>();
1299-
let mut state = state.lock().await;
1300-
state.launch_profiles.remove_entry(uuid);
1301-
state.save();
1299+
{
1300+
// Delete the profile and save to disk
1301+
let mut state = state.lock().await;
1302+
state.launch_profiles.remove_entry(uuid);
1303+
state.save();
1304+
}
1305+
1306+
// Delete compat dir if it exists
1307+
#[cfg(not(target_os = "windows"))]
1308+
{
1309+
let statics = get_app_statics();
1310+
let compat_dir = statics.compat_data_dir.join(uuid.to_string());
1311+
if compat_dir.exists() {
1312+
if let Err(e) = std::fs::remove_dir_all(&compat_dir) {
1313+
warn!(
1314+
"Failed to remove compat data directory for launch profile {}: {}",
1315+
uuid, e
1316+
);
1317+
}
1318+
}
1319+
}
1320+
13021321
Ok(())
13031322
};
13041323
internal.await.map_err(|e: Error| e.to_string())

0 commit comments

Comments
 (0)