shuf
This commit is contained in:
parent
8c51e43e79
commit
34f9b418ff
1 changed files with 5 additions and 9 deletions
|
@ -9,15 +9,13 @@ import java.nio.file.Path
|
|||
import java.nio.file.Paths
|
||||
import java.util.*
|
||||
|
||||
val file = File("./run/conf.properties")
|
||||
val prop = Properties()
|
||||
|
||||
|
||||
//TODO: make them variables work :(
|
||||
//init values
|
||||
public val winW = prop.getProperty("winWidth")
|
||||
//public val WINDOW_WIDTH = winW.toInt()
|
||||
|
||||
class Config {
|
||||
val file = File("./run/potrogue.conf")
|
||||
val prop = Properties()
|
||||
var fileExists = file.exists()
|
||||
init {
|
||||
//Config Stage
|
||||
|
@ -26,13 +24,13 @@ class Config {
|
|||
}
|
||||
else{
|
||||
Files.createDirectories(Paths.get("./run"))
|
||||
Files.createFile(Path.of("./run/conf.properties"))
|
||||
Files.createFile(Path.of("./run/potrogue.conf"))
|
||||
FileInputStream(file).use { prop.load(it) }
|
||||
}
|
||||
|
||||
FileInputStream(file).use {
|
||||
prop.load(it)
|
||||
prop.setProperty("winWidth", "80")
|
||||
prop.setProperty("WINDOW_WIDTH", "80")
|
||||
prop.setProperty("WINDOW_HEIGHT", "50")
|
||||
|
||||
val out: OutputStream = FileOutputStream(file)
|
||||
|
@ -44,6 +42,4 @@ class Config {
|
|||
.associateWith {prop.getProperty(it)}
|
||||
.forEach { println(it) }
|
||||
}
|
||||
|
||||
val winW = prop.getProperty("winWidth")
|
||||
}
|
Loading…
Reference in a new issue