mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Fix: Deleteing known folder should resolve as error
This commit is contained in:
@@ -125,22 +125,27 @@ export class FileSystemAccess {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isKnown) {
|
||||
if (onError) {
|
||||
onError({ message: "Cannot delete known folder." });
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Asynchronous
|
||||
this.deleteFolderContent(javaFile);
|
||||
|
||||
if (!isKnown) {
|
||||
if (javaFile.delete()) {
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
} else {
|
||||
if (onError) {
|
||||
onError({ message: "Folder deletion failed." });
|
||||
}
|
||||
if (javaFile.delete()) {
|
||||
if (onSuccess) {
|
||||
onSuccess();
|
||||
}
|
||||
} else {
|
||||
// TODO: Notify error?
|
||||
if (onError) {
|
||||
onError({ message: "Folder deletion failed." });
|
||||
}
|
||||
}
|
||||
|
||||
} catch (exception) {
|
||||
if (onError) {
|
||||
onError(exception);
|
||||
|
||||
@@ -176,6 +176,14 @@ export class FileSystemAccess {
|
||||
}
|
||||
|
||||
public deleteFolder(path: string, isKnown?: boolean, onSuccess?: () => any, onError?: (error: any) => any) {
|
||||
if (isKnown) {
|
||||
if (onError) {
|
||||
onError({ message: "Cannot delete known folder." });
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.deleteEntity(path, onSuccess, onError);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user