mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 04:54:05 +09:00
new savegame loading wip
This commit is contained in:
@@ -50,13 +50,13 @@ removefile:
|
||||
|
||||
fun checkFileSanity() {
|
||||
if (!diskFile.exists()) throw NoSuchFileException(diskFile.absoluteFile)
|
||||
if (diskFile.length() < 310L) throw RuntimeException("Invalid Virtual Disk file!")
|
||||
if (diskFile.length() < 310L) throw RuntimeException("Invalid Virtual Disk file: ${diskFile.path}")
|
||||
|
||||
// check magic
|
||||
val fis = FileInputStream(diskFile)
|
||||
|
||||
val magic = ByteArray(4).let { fis.read(it); it }
|
||||
if (!magic.contentEquals(VirtualDisk.MAGIC)) throw RuntimeException("Invalid Virtual Disk file!")
|
||||
if (!magic.contentEquals(VirtualDisk.MAGIC)) throw RuntimeException("Invalid Virtual Disk file: ${diskFile.path}")
|
||||
|
||||
fis.close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user