mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 19:44:58 +00: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 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){
|
||||
try {
|
||||
mode = parseNativeMode(mode);
|
||||
mode = FileUtils.parseNativeMode(mode);
|
||||
Context context = PandroidApplication.getAppContext();
|
||||
Uri uri = FileUtils.obtainUri(path);
|
||||
ParcelFileDescriptor parcel;
|
||||
|
|
|
@ -66,6 +66,27 @@ public class FileUtils {
|
|||
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) {
|
||||
return parseFile(path).exists();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue