Merge branch 'languages' into develop
This commit is contained in:
@@ -24,6 +24,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class FileIO<T> {
|
||||
private final String TAG = FileIO.class.getCanonicalName();
|
||||
@@ -34,8 +35,14 @@ public class FileIO<T> {
|
||||
AssetManager am = context.getAssets();
|
||||
T res = null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
InputStream is = null;
|
||||
try {
|
||||
InputStream is = am.open(fileName);
|
||||
if (Arrays.asList(context.getResources().getAssets().list("")).contains(fileName)) {
|
||||
is = am.open(fileName);
|
||||
Log.d(TAG, "Opening file: " + fileName);
|
||||
} else {
|
||||
is = am.open(fileName.substring(0, fileName.length() - 8) + ".json");
|
||||
}
|
||||
InputStreamReader inputStreamReader = new InputStreamReader(is);
|
||||
BufferedReader reader = new BufferedReader(inputStreamReader);
|
||||
String line;
|
||||
|
||||
Reference in New Issue
Block a user