mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
fix: autosave is not loading
This commit is contained in:
@@ -26,10 +26,10 @@ import kotlin.math.roundToInt
|
||||
/**
|
||||
* Created by minjaesong on 2023-06-24.
|
||||
*/
|
||||
class SavegameCollection(files0: List<DiskSkimmer>, prefiltered: Boolean) {
|
||||
class SavegameCollection(files0: List<DiskSkimmer>) {
|
||||
|
||||
/** Sorted in reverse by the last modified time of the files, index zero being the most recent */
|
||||
val files = if (prefiltered) files0 else files0.sortedBy { it.diskFile.name }.sortedByDescending {
|
||||
val files = files0.sortedBy { it.diskFile.name }.sortedByDescending {
|
||||
it.getLastModifiedTime().shl(2) or
|
||||
it.diskFile.extension.matches(Regex("^[abc]${'$'}")).toLong(1) or
|
||||
it.diskFile.extension.isBlank().toLong(0)
|
||||
@@ -54,14 +54,14 @@ class SavegameCollection(files0: List<DiskSkimmer>, prefiltered: Boolean) {
|
||||
|
||||
companion object {
|
||||
fun collectFromBaseFilename(skimmers: List<DiskSkimmer>, name: String): SavegameCollection {
|
||||
return SavegameCollection(skimmers, true)
|
||||
return SavegameCollection(skimmers)
|
||||
}
|
||||
|
||||
|
||||
fun collectFromBaseFilename(dir: File, name: String): SavegameCollection {
|
||||
val files = dir.listFiles().filter { it.name.startsWith(name) }
|
||||
.mapNotNull { try { DiskSkimmer(it, true) } catch (e: Throwable) { null } }
|
||||
return SavegameCollection(files, false)
|
||||
return SavegameCollection(files)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user