fix: fixed (?) error on deleting non-installed voice package

I didn't test this but I think it should work lol
This commit is contained in:
Observer KRypt0n_ 2023-02-28 22:52:18 +02:00
parent 8935e566d9
commit a3aad7a2f4
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2

View file

@ -626,19 +626,25 @@ impl SimpleAsyncComponent for GeneralApp {
let package = VoicePackage::with_locale(package.locale).unwrap();
std::thread::spawn(move || {
if let Err(err) = package.delete_in(&config.game.path) {
tracing::error!("Failed to delete voice package: {:?}", package.locale());
sender.input(GeneralAppMsg::Toast {
title: tr("voice-package-deletion-error"),
description: Some(err.to_string())
});
}
if !package.is_installed_in(&config.game.path) {
std::thread::spawn(move || {
if let Err(err) = package.delete_in(&config.game.path) {
tracing::error!("Failed to delete voice package: {:?}", package.locale());
sender.input(GeneralAppMsg::Toast {
title: tr("voice-package-deletion-error"),
description: Some(err.to_string())
});
}
sender.input(GeneralAppMsg::SetVoicePackageSensitivity(index, true));
sender.output(PreferencesAppMsg::UpdateLauncherState);
});
}
else {
sender.input(GeneralAppMsg::SetVoicePackageSensitivity(index, true));
sender.output(PreferencesAppMsg::UpdateLauncherState);
});
}
}
}
}