mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 19:44:05 +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.
|
* 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 */
|
/** 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.getLastModifiedTime().shl(2) or
|
||||||
it.diskFile.extension.matches(Regex("^[abc]${'$'}")).toLong(1) or
|
it.diskFile.extension.matches(Regex("^[abc]${'$'}")).toLong(1) or
|
||||||
it.diskFile.extension.isBlank().toLong(0)
|
it.diskFile.extension.isBlank().toLong(0)
|
||||||
@@ -54,14 +54,14 @@ class SavegameCollection(files0: List<DiskSkimmer>, prefiltered: Boolean) {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun collectFromBaseFilename(skimmers: List<DiskSkimmer>, name: String): SavegameCollection {
|
fun collectFromBaseFilename(skimmers: List<DiskSkimmer>, name: String): SavegameCollection {
|
||||||
return SavegameCollection(skimmers, true)
|
return SavegameCollection(skimmers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun collectFromBaseFilename(dir: File, name: String): SavegameCollection {
|
fun collectFromBaseFilename(dir: File, name: String): SavegameCollection {
|
||||||
val files = dir.listFiles().filter { it.name.startsWith(name) }
|
val files = dir.listFiles().filter { it.name.startsWith(name) }
|
||||||
.mapNotNull { try { DiskSkimmer(it, true) } catch (e: Throwable) { null } }
|
.mapNotNull { try { DiskSkimmer(it, true) } catch (e: Throwable) { null } }
|
||||||
return SavegameCollection(files, false)
|
return SavegameCollection(files)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user