Android autosave location fix (#8572)

This commit is contained in:
Gualdimar 2023-02-04 19:36:26 +02:00 committed by GitHub
parent 8e94998106
commit 1018460730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -417,8 +417,13 @@ class UncivFiles(
if(nextTurn) {
val newAutosaveFilename =
SAVE_FILES_FOLDER + File.separator + AUTOSAVE_FILE_NAME + "-${gameInfo.currentPlayer}-${gameInfo.turns}"
getSave(AUTOSAVE_FILE_NAME).copyTo(files.local(newAutosaveFilename))
val file =
if (preferExternalStorage && files.isExternalStorageAvailable)
files.external(newAutosaveFilename)
else
files.local(newAutosaveFilename)
getSave(AUTOSAVE_FILE_NAME).copyTo(file)
fun getAutosaves(): Sequence<FileHandle> {
return getSaves().filter { it.name().startsWith(AUTOSAVE_FILE_NAME) }
}