mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Copied files in Android should now overwrite existing files
This commit is contained in:
parent
e951ed8324
commit
e690e3bcea
@ -47,16 +47,16 @@ class AndroidLauncher : AndroidApplication() {
|
|||||||
* replaces them with the ones in the external folder!)
|
* replaces them with the ones in the external folder!)
|
||||||
*/
|
*/
|
||||||
private fun copyMods() {
|
private fun copyMods() {
|
||||||
// Mod directory in the internal app data (where Gdx.files.local looks)
|
// Mod directory in the internal app data (where Gdx.files.local looks)
|
||||||
val internalModsDir = File("${filesDir.path}/mods")
|
val internalModsDir = File("${filesDir.path}/mods")
|
||||||
|
|
||||||
// Mod directory in the shared app data (where the user can see and modify)
|
// Mod directory in the shared app data (where the user can see and modify)
|
||||||
val externalModsDir = File("${getExternalFilesDir(null)?.path}/mods")
|
val externalModsDir = File("${getExternalFilesDir(null)?.path}/mods")
|
||||||
|
|
||||||
// Copy external mod directory (with data user put in it) to internal (where it can be read)
|
// 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.mkdirs() // this can fail sometimes, which is why we check if it exists again in the next line
|
||||||
if (externalModsDir.exists()) externalModsDir.copyRecursively(internalModsDir)
|
if (externalModsDir.exists()) externalModsDir.copyRecursively(internalModsDir, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
if (UncivGame.Companion.isCurrentInitialized()
|
if (UncivGame.Companion.isCurrentInitialized()
|
||||||
|
Loading…
Reference in New Issue
Block a user