From 979c3c813becbde36570b61837962430ee595d8d Mon Sep 17 00:00:00 2001 From: Boy0000 <62521371+Boy0000@users.noreply.github.com> Date: Thu, 23 Jun 2022 22:29:55 +0200 Subject: [PATCH] handle mod uninstall when game is open (#24) --- .../kotlin/com/mineinabyss/launchy/logic/LaunchyState.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/mineinabyss/launchy/logic/LaunchyState.kt b/src/main/kotlin/com/mineinabyss/launchy/logic/LaunchyState.kt index 1dc3a59..b9b6580 100644 --- a/src/main/kotlin/com/mineinabyss/launchy/logic/LaunchyState.kt +++ b/src/main/kotlin/com/mineinabyss/launchy/logic/LaunchyState.kt @@ -122,8 +122,13 @@ class LaunchyState( } for (mod in queuedDeletions) { launch(Dispatchers.IO) { - mod.file.deleteIfExists() - _deleted++ + try { + mod.file.deleteIfExists() + } catch (e: FileSystemException) { + return@launch + } finally { + _deleted++ + } } } }