From c18786471a6d4148ea31e4a56d959761ec8a624f Mon Sep 17 00:00:00 2001 From: Reco1l Date: Mon, 21 Aug 2023 12:54:55 +0200 Subject: [PATCH 1/2] Place `multi_log` file always in default core path --- src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt b/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt index bef885a6e..5865ff67d 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt +++ b/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt @@ -63,7 +63,7 @@ object Multiplayer var finalData: Array? = null - private val LOG_FILE = File("${Config.getCorePath()}/Log", "multi_log.txt") + private val LOG_FILE = File("${Config.getDefaultCorePath()}/Log", "multi_log.txt") init { From 29759f9a6f6d94f9f274e5c5ba24331899b6344a Mon Sep 17 00:00:00 2001 From: Reco1l Date: Mon, 21 Aug 2023 13:07:10 +0200 Subject: [PATCH 2/2] Ensure the /Log folder is created before trying to create `multi_log` --- src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt b/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt index 5865ff67d..9d53db9bc 100644 --- a/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt +++ b/src/com/reco1l/legacy/ui/multiplayer/Multiplayer.kt @@ -63,7 +63,15 @@ object Multiplayer var finalData: Array? = null - private val LOG_FILE = File("${Config.getDefaultCorePath()}/Log", "multi_log.txt") + private val LOG_FOLDER = File("${Config.getDefaultCorePath()}/Log").apply { + if (!exists()) + mkdirs() + } + + private val LOG_FILE = File(LOG_FOLDER, "multi_log.txt").apply { + if (!exists()) + createNewFile() + } init {