From e690e3bcea9d6295906b05c0ec686ae8251e93b4 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Wed, 7 Oct 2020 14:02:38 +0300 Subject: [PATCH] Copied files in Android should now overwrite existing files --- android/src/com/unciv/app/AndroidLauncher.kt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/android/src/com/unciv/app/AndroidLauncher.kt b/android/src/com/unciv/app/AndroidLauncher.kt index dc421a7e1d..17b8b01d51 100644 --- a/android/src/com/unciv/app/AndroidLauncher.kt +++ b/android/src/com/unciv/app/AndroidLauncher.kt @@ -47,16 +47,16 @@ class AndroidLauncher : AndroidApplication() { * replaces them with the ones in the external folder!) */ private fun copyMods() { - // Mod directory in the internal app data (where Gdx.files.local looks) - val internalModsDir = File("${filesDir.path}/mods") + // Mod directory in the internal app data (where Gdx.files.local looks) + val internalModsDir = File("${filesDir.path}/mods") - // Mod directory in the shared app data (where the user can see and modify) - val externalModsDir = File("${getExternalFilesDir(null)?.path}/mods") + // Mod directory in the shared app data (where the user can see and modify) + val externalModsDir = File("${getExternalFilesDir(null)?.path}/mods") - // Copy external mod directory (with data user put in it) to internal (where it can be read) - if (!externalModsDir.exists()) externalModsDir.mkdirs() // this can fail sometimes, which is why we check if it exists again in the next line - if (externalModsDir.exists()) externalModsDir.copyRecursively(internalModsDir) - } + // Copy external mod directory (with data user put in it) to internal (where it can be read) + if (!externalModsDir.exists()) externalModsDir.mkdirs() // this can fail sometimes, which is why we check if it exists again in the next line + if (externalModsDir.exists()) externalModsDir.copyRecursively(internalModsDir, true) + } override fun onPause() { if (UncivGame.Companion.isCurrentInitialized()