aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 13:08:14 -0500
committerWyvest <45589059+Wyvest@users.noreply.github.com>2023-01-14 13:08:14 -0500
commit27aa4095270f943ddab2a4e4d370e225766c7ff7 (patch)
treef1d71fe46072cfab38ad833be96600bd26c04cb7 /src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt
parent3470ee81c4444c5955f7899acce226dae14a3da4 (diff)
downloadChatting-27aa4095270f943ddab2a4e4d370e225766c7ff7.tar.gz
Chatting-27aa4095270f943ddab2a4e4d370e225766c7ff7.tar.bz2
Chatting-27aa4095270f943ddab2a4e4d370e225766c7ff7.zip
change directory of chat tabs and shortcuts
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt')
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt
index f3145de..6add813 100644
--- a/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt
+++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatShortcuts.kt
@@ -1,12 +1,14 @@
package cc.woverflow.chatting.chat
+import cc.polyfrost.oneconfig.config.core.ConfigUtils
import cc.woverflow.chatting.Chatting
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import java.io.File
object ChatShortcuts {
- private val shortcutsFile = File(Chatting.modDir, "chatshortcuts.json")
+ private val oldShortcutsFile = File(Chatting.oldModDir, "chatshortcuts.json")
+ private val shortcutsFile = ConfigUtils.getProfileFile("chatshortcuts.json")
private val PARSER = JsonParser()
private var initialized = false
@@ -31,9 +33,13 @@ object ChatShortcuts {
}
if (!shortcutsFile.exists()) {
shortcutsFile.createNewFile()
- shortcutsFile.writeText(
+ if (oldShortcutsFile.exists()) {
+ shortcutsFile.writeText(
+ oldShortcutsFile.readText()
+ )
+ } else {
JsonObject().toString()
- )
+ }
} else {
val jsonObj = PARSER.parse(shortcutsFile.readText()).asJsonObject
for (shortcut in jsonObj.entrySet()) {