mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-19 01:05:22 +12:00
Fix
This commit is contained in:
parent
5772516126
commit
36895ede35
2 changed files with 22 additions and 21 deletions
|
@ -33,30 +33,10 @@ public class AlberDriver {
|
||||||
public static native void setShaderJitEnabled(boolean enable);
|
public static native void setShaderJitEnabled(boolean enable);
|
||||||
|
|
||||||
|
|
||||||
public static String parseNativeMode(String mode){
|
|
||||||
mode = mode.toLowerCase();
|
|
||||||
switch (mode){
|
|
||||||
case "r":
|
|
||||||
case "rb":
|
|
||||||
return "r";
|
|
||||||
case "r+":
|
|
||||||
case "r+b":
|
|
||||||
case "rb+":
|
|
||||||
return "rw";
|
|
||||||
case "w+":
|
|
||||||
return "rwt";
|
|
||||||
case "w":
|
|
||||||
case "wb":
|
|
||||||
return "wt";
|
|
||||||
case "wa":
|
|
||||||
return "wa";
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException("Invalid file mode: "+mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int openDocument(String path, String mode){
|
public static int openDocument(String path, String mode){
|
||||||
try {
|
try {
|
||||||
mode = parseNativeMode(mode);
|
mode = FileUtils.parseNativeMode(mode);
|
||||||
Context context = PandroidApplication.getAppContext();
|
Context context = PandroidApplication.getAppContext();
|
||||||
Uri uri = FileUtils.obtainUri(path);
|
Uri uri = FileUtils.obtainUri(path);
|
||||||
ParcelFileDescriptor parcel;
|
ParcelFileDescriptor parcel;
|
||||||
|
|
|
@ -66,6 +66,27 @@ public class FileUtils {
|
||||||
return file.getAbsolutePath();
|
return file.getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String parseNativeMode(String mode){
|
||||||
|
mode = mode.toLowerCase();
|
||||||
|
switch (mode){
|
||||||
|
case "r":
|
||||||
|
case "rb":
|
||||||
|
return "r";
|
||||||
|
case "r+":
|
||||||
|
case "r+b":
|
||||||
|
case "rb+":
|
||||||
|
return "rw";
|
||||||
|
case "w+":
|
||||||
|
return "rwt";
|
||||||
|
case "w":
|
||||||
|
case "wb":
|
||||||
|
return "wt";
|
||||||
|
case "wa":
|
||||||
|
return "wa";
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Invalid file mode: "+mode);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean exists(String path) {
|
public static boolean exists(String path) {
|
||||||
return parseFile(path).exists();
|
return parseFile(path).exists();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue