No longer dump stuff in home folder on Linux

This commit is contained in:
Eli Stone 2022-04-24 10:54:58 -06:00
parent dfbe3414a1
commit 57f6ede15d
3 changed files with 22 additions and 5 deletions

View file

@ -8,11 +8,24 @@ import java.io.FileWriter
object Json {
val HOME = System.getProperty("user.home")
val os = System.getProperty("os.name").toLowerCase()
var HOME = when(os.contains("nix") || os.contains("nux") || os.contains("aix")) {
true -> System.getProperty("user.home") + "/.local/share/2009scape"
false -> System.getProperty("user.home")
}
val CONF = HOME + File.separator + "config.json"
var data: JSONObject = JSONObject()
init {
val dir = File(HOME)
if (!dir.exists()) {
dir.mkdirs()
}
}
fun save(){
val osName = System.getProperty("os.name").toLowerCase()
val customization = data["customization"] as JSONObject
val xpDrops = customization["xpdrops"] as JSONObject
val slayer = customization["slayer"] as JSONObject