diff --git a/core/src/com/unciv/logic/files/UncivFiles.kt b/core/src/com/unciv/logic/files/UncivFiles.kt index 0e7e77e295600..5269da0a72b5a 100644 --- a/core/src/com/unciv/logic/files/UncivFiles.kt +++ b/core/src/com/unciv/logic/files/UncivFiles.kt @@ -42,7 +42,7 @@ class UncivFiles( private val files: Files, /** If not null, this is the path to the directory in which to store the local files - mods, saves, maps, etc */ - val customDataDirectory: String? + val customDataDirectory: String? = null ) { init { debug("Creating UncivFiles, localStoragePath: %s, externalStoragePath: %s", diff --git a/core/src/com/unciv/models/translations/TranslationFileWriter.kt b/core/src/com/unciv/models/translations/TranslationFileWriter.kt index f863845aa1a9d..7db79a533886a 100644 --- a/core/src/com/unciv/models/translations/TranslationFileWriter.kt +++ b/core/src/com/unciv/models/translations/TranslationFileWriter.kt @@ -1,5 +1,6 @@ package com.unciv.models.translations +import com.badlogic.gdx.Gdx import com.badlogic.gdx.files.FileHandle import com.unciv.UncivGame import com.unciv.json.fromJsonFile @@ -259,7 +260,7 @@ object TranslationFileWriter { // used for unit test only fun getGeneratedStringsSize(): Int { - return GenerateStringsFromJSONs(UncivGame.Current.files.getLocalFile("jsons/Civ V - Vanilla")).values.sumOf { + return GenerateStringsFromJSONs(Gdx.files.local("jsons/Civ V - Vanilla")).values.sumOf { // exclude empty lines it.count { line: String -> !line.startsWith(specialNewLineCode) } } diff --git a/tests/src/com/unciv/testing/BasicTests.kt b/tests/src/com/unciv/testing/BasicTests.kt index be274f819ca31..8e513b35853a0 100644 --- a/tests/src/com/unciv/testing/BasicTests.kt +++ b/tests/src/com/unciv/testing/BasicTests.kt @@ -1,6 +1,7 @@ // Taken from https://github.com/TomGrill/gdx-testing package com.unciv.testing +import com.badlogic.gdx.Gdx import com.unciv.Constants import com.unciv.UncivGame import com.unciv.models.metadata.BaseRuleset @@ -39,7 +40,7 @@ class BasicTests { @Test fun gamePngExists() { Assert.assertTrue("This test will only pass when the game.png exists", - UncivGame.Current.files.getDataFolder().list().any { it.name().endsWith(".png") }) + Gdx.files.local("").list().any { it.name().endsWith(".png") }) } @Test