Skip to content

Commit 66d9669

Browse files
a bit clearer code
1 parent 556c611 commit 66d9669

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

RemixedDungeon/src/android/java/com/nyrds/platform/util/StringsManager.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.nyrds.pixeldungeon.ml.R;
99
import com.nyrds.platform.app.RemixedDungeonApp;
1010
import com.nyrds.platform.game.Game;
11+
import com.nyrds.util.ModError;
1112
import com.nyrds.util.ModdingMode;
1213
import com.nyrds.util.Util;
1314
import com.watabou.pixeldungeon.utils.GLog;
@@ -18,8 +19,6 @@
1819
import org.json.JSONException;
1920

2021
import java.io.BufferedReader;
21-
import java.io.File;
22-
import java.io.FileInputStream;
2322
import java.io.InputStream;
2423
import java.io.InputStreamReader;
2524
import java.lang.reflect.Field;
@@ -92,15 +91,10 @@ private static void clearModStrings() {
9291

9392
@SneakyThrows
9493
private static void parseStrings(String resource) {
95-
File jsonFile = ModdingMode.getFile(resource);
96-
if (jsonFile == null || !jsonFile.exists()) {
97-
return;
98-
}
99-
10094
String line = Utils.EMPTY_STRING;
10195

10296
try {
103-
InputStream fis = new FileInputStream(jsonFile);
97+
InputStream fis = ModdingMode.getInputStream(resource);
10498
InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);
10599
BufferedReader br = new BufferedReader(isr);
106100

@@ -136,7 +130,8 @@ private static void parseStrings(String resource) {
136130
br.close();
137131
} catch (JSONException e) {
138132
Game.toast("malformed json: [%s] in [%s] ignored ", line, resource);
139-
}
133+
} catch (ModError ignored) {
134+
}
140135
}
141136

142137
private static Locale userSelectedLocale;

0 commit comments

Comments
 (0)