mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -04:00
linux: fix moving files between different disks
This commit is contained in:
parent
a009167fae
commit
180bad9d46
@ -22,6 +22,7 @@ import okio.Buffer
|
||||
import java.io.File
|
||||
import java.io.FileWriter
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
|
||||
class Configuration(private val configName: String = StaticConfiguration.CONFIG_FILENAME) {
|
||||
private val file = File(StaticConfiguration.HOME_DIRECTORY + "config/minosoft/" + configName)
|
||||
@ -74,11 +75,7 @@ class Configuration(private val configName: String = StaticConfiguration.CONFIG_
|
||||
throw RuntimeException("Could not save config!")
|
||||
}
|
||||
}
|
||||
if (!tempFile.renameTo(file)) {
|
||||
Log.fatal("An error occurred while saving the config file")
|
||||
} else {
|
||||
Log.verbose("Configuration saved to file %s", configName)
|
||||
}
|
||||
Files.move(tempFile.toPath(), file.toPath())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import de.bixilon.minosoft.util.Util
|
||||
import de.bixilon.minosoft.util.logging.Log
|
||||
import de.bixilon.minosoft.util.logging.LogLevels
|
||||
import java.io.*
|
||||
import java.nio.file.Files
|
||||
import java.security.MessageDigest
|
||||
import java.util.zip.GZIPOutputStream
|
||||
|
||||
@ -105,13 +106,11 @@ interface FileAssetsManager : AssetsManager {
|
||||
if (outputFile.exists()) {
|
||||
// file is already extracted
|
||||
if (!tempDestinationFile.delete()) {
|
||||
throw IllegalStateException(String.format("Could not delete temporary file %s", tempDestinationFile.absolutePath))
|
||||
throw IllegalStateException("Could not delete temporary file ${tempDestinationFile.absolutePath}")
|
||||
}
|
||||
return hash
|
||||
}
|
||||
if (!tempDestinationFile.renameTo(outputFile)) {
|
||||
throw IllegalStateException(String.format("Could not rename file %s to %s", tempDestinationFile.absolutePath, outputFile.absolutePath))
|
||||
}
|
||||
Files.move(tempDestinationFile.toPath(), outputFile.toPath())
|
||||
return hash
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ open class MinecraftLanguage : Translator {
|
||||
|
||||
constructor(language: String, data: String) {
|
||||
this.language = language
|
||||
for (line in data.split("\\r?\\n").toTypedArray()) {
|
||||
for (line in data.lines().toTypedArray()) {
|
||||
if (line.isBlank()) {
|
||||
continue
|
||||
}
|
||||
|
@ -239,10 +239,6 @@ class Camera(
|
||||
return glm.lookAt(cameraPosition, cameraPosition + cameraFront, CAMERA_UP_VEC3)
|
||||
}
|
||||
|
||||
fun setFOV(fov: Float) {
|
||||
this.fov = fov
|
||||
}
|
||||
|
||||
fun setRotation(yaw: Float, pitch: Float) {
|
||||
playerEntity.rotation = EntityRotation(yaw.toDouble(), pitch.toDouble())
|
||||
|
||||
@ -303,6 +299,5 @@ class Camera(
|
||||
companion object {
|
||||
private val CAMERA_UP_VEC3 = Vec3(0.0f, 1.0f, 0.0f)
|
||||
private const val PLAYER_HEIGHT = 1.3 // player is 1.8 blocks high, the camera is normally at 0.5. 1.8 - 0.5 = 1.13
|
||||
const val PLAYER_WIDTH = 0.60001
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user