diff --git a/src/ui/ui_import_games.rs b/src/ui/ui_import_games.rs index 5162a5a..fee5492 100644 --- a/src/ui/ui_import_games.rs +++ b/src/ui/ui_import_games.rs @@ -107,7 +107,7 @@ impl MyEguiApp { } } - pub fn run_sync(&mut self) { + pub fn run_sync(&mut self, wait: bool ) { let (sender, reciever) = watch::channel(SyncProgress::NotStarted); let settings = self.settings.clone(); if settings.steam.stop_steam { @@ -115,7 +115,7 @@ impl MyEguiApp { } self.status_reciever = reciever; - self.rt.spawn_blocking(move || { + let handle = self.rt.spawn_blocking(move || { MyEguiApp::save_settings_to_file(&settings); let mut some_sender = Some(sender); backup_shortcuts(&settings.steam); @@ -133,6 +133,9 @@ impl MyEguiApp { crate::steam::ensure_steam_started(&settings.steam); } }); + if wait { + self.rt.block_on(handle).unwrap(); + } } pub fn save_settings_to_file(settings: &Settings) { diff --git a/src/ui/uiapp.rs b/src/ui/uiapp.rs index 090fcc8..88b3ebd 100644 --- a/src/ui/uiapp.rs +++ b/src/ui/uiapp.rs @@ -181,7 +181,7 @@ impl App for MyEguiApp { .clicked() && !syncing { - self.run_sync(); + self.run_sync(false); } }); } @@ -272,7 +272,7 @@ fn setup(ctx: &egui::Context) { } pub fn run_sync() { let mut app = MyEguiApp::new(); - app.run_sync(); + app.run_sync(true); } pub fn run_ui(args: Vec) -> Result<(), Box> {