forked from github/cordova-android
File APIs should return error code instead of object.
This commit is contained in:
parent
d593448182
commit
f6503f8476
@ -131,8 +131,7 @@ public class FileUtils extends Plugin {
|
|||||||
long size = args.optLong(1);
|
long size = args.optLong(1);
|
||||||
if (size != 0) {
|
if (size != 0) {
|
||||||
if (size > (DirectoryManager.getFreeDiskSpace(true)*1024)) {
|
if (size > (DirectoryManager.getFreeDiskSpace(true)*1024)) {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.QUOTA_EXCEEDED_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.QUOTA_EXCEEDED_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONObject obj = requestFileSystem(args.getInt(0));
|
JSONObject obj = requestFileSystem(args.getInt(0));
|
||||||
@ -171,8 +170,7 @@ public class FileUtils extends Plugin {
|
|||||||
notifyDelete(args.getString(0));
|
notifyDelete(args.getString(0));
|
||||||
return new PluginResult(status);
|
return new PluginResult(status);
|
||||||
} else {
|
} else {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action.equals("removeRecursively")) {
|
else if (action.equals("removeRecursively")) {
|
||||||
@ -180,8 +178,7 @@ public class FileUtils extends Plugin {
|
|||||||
if (success) {
|
if (success) {
|
||||||
return new PluginResult(status);
|
return new PluginResult(status);
|
||||||
} else {
|
} else {
|
||||||
JSONObject error = new JSONObject().put("code", FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
return new PluginResult(PluginResult.Status.ERROR, FileUtils.NO_MODIFICATION_ALLOWED_ERR);
|
||||||
return new PluginResult(PluginResult.Status.ERROR, error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (action.equals("moveTo")) {
|
else if (action.equals("moveTo")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user