disallowing nicknames (may contain non-ascii) on filename: somehow incompatible with BTRFS and Java 17?

This commit is contained in:
minjaesong
2023-05-17 19:52:51 +09:00
parent 4ba1173d8a
commit 68b5d15944
6 changed files with 12 additions and 13 deletions

View File

@@ -788,7 +788,7 @@ fun AppUpdateListOfSavegames() {
// create list of worlds
File(worldsDir).listFiles().filter { !it.isDirectory && !it.name.contains('.') }.mapNotNull { file ->
try {
DiskSkimmer(file, Common.CHARSET, true)
DiskSkimmer(file, true)
}
catch (e: Throwable) {
System.err.println("Unable to load a world file ${file.absolutePath}")
@@ -814,7 +814,7 @@ fun AppUpdateListOfSavegames() {
// create list of players
File(playersDir).listFiles().filter { !it.isDirectory && !it.name.contains('.') }.mapNotNull { file ->
try {
DiskSkimmer(file, Common.CHARSET, true)
DiskSkimmer(file, true)
}
catch (e: Throwable) {
System.err.println("Unable to load a player file ${file.absolutePath}")

View File

@@ -381,7 +381,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
private fun postInitForNewGame() {
worldSavefileName = LoadSavegame.getWorldSavefileName(savegameNickname, world)
worldSavefileName = LoadSavegame.getWorldSavefileName(world)
playerSavefileName = LoadSavegame.getPlayerSavefileName(actorGamer)
worldDisk = VDUtil.createNewDisk(

View File

@@ -46,7 +46,7 @@ class QuickSingleplayerWorldSavingThread(
override fun save() {
val skimmer = DiskSkimmer(outFile, Common.CHARSET)
val skimmer = DiskSkimmer(outFile)
if (hasThumbnail) {
while (!IngameRenderer.fboRGBexportedLatch) {

View File

@@ -108,8 +108,8 @@ object WriteSavegame {
object LoadSavegame {
fun getSavegameNickname(worldDisk: SimpleFileSystem) = worldDisk.getDiskName(Common.CHARSET)
fun getWorldSavefileName(nick: String, world: GameWorld) = "$nick-${world.worldIndex}"
fun getPlayerSavefileName(player: IngamePlayer) = (player.actorValue.getAsString(AVKey.NAME) ?: "Player") + "-${player.uuid}"
fun getWorldSavefileName(world: GameWorld) = "${world.worldIndex}"
fun getPlayerSavefileName(player: IngamePlayer) = "${player.uuid}"
fun getFileBytes(disk: SimpleFileSystem, id: Long): ByteArray64 = disk.getFile(id)!!.bytes
fun getFileReader(disk: SimpleFileSystem, id: Long): Reader = ByteArray64Reader(getFileBytes(disk, id), Common.CHARSET)
@@ -136,7 +136,7 @@ object LoadSavegame {
newIngame.worldDisk = VDUtil.readDiskArchive(worldDisk.diskFile, Level.INFO)
newIngame.playerDisk = VDUtil.readDiskArchive(playerDisk.diskFile, Level.INFO)
newIngame.savegameNickname = getSavegameNickname(worldDisk)
newIngame.worldSavefileName = getWorldSavefileName(newIngame.savegameNickname, world)
newIngame.worldSavefileName = getWorldSavefileName(world)
newIngame.playerSavefileName = getPlayerSavefileName(player)
// worldDisk.dispose()

View File

@@ -239,14 +239,14 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
it.seed = seed shake selectionMagic
}
val terrainAutocorrect = ModuleAutoCorrect().also { // absolutely required
val terrainScaleOffset = ModuleScaleOffset().also {
it.setSource(terrainTypeFractal)
it.setLow(0.0)
it.setHigh(1.0)
} // TODO REPLACE WITH ScaleOffset and play with the both values
it.setOffset(0.5)
it.setScale(0.5)
}
val terrainTypeYScale = ModuleScaleDomain().also {
it.setSource(terrainAutocorrect)
it.setSource(terrainScaleOffset)
it.setScaleY(0.0)
}

View File

@@ -21,7 +21,6 @@ import kotlin.experimental.and
*/
class DiskSkimmer(
val diskFile: File,
val charset: Charset = Charset.defaultCharset(),
noInit: Boolean = false
): SimpleFileSystem {