Skip to content

Commit

Permalink
chore(android): improve error message when Filesystem.copy fails (#3148)
Browse files Browse the repository at this point in the history
  • Loading branch information
asztal authored Jul 6, 2020
1 parent 8651ef1 commit 598d7dc
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -579,23 +579,22 @@ private void _copy(PluginCall call, boolean doRename) {
toObject.delete();

assert fromObject != null;
boolean modified = false;

if (doRename) {
modified = fromObject.renameTo(toObject);
boolean modified = fromObject.renameTo(toObject);
if (!modified) {
call.error("Unable to rename, unknown reason");
return;
}
} else {
try {
copyRecursively(fromObject, toObject);
modified = true;
} catch (IOException ignored) {
} catch (IOException e) {
call.error("Unable to perform action: " + e.getLocalizedMessage());
return;
}
}

if (!modified) {
call.error("Unable to perform action, unknown reason");
return;
}

call.success();
}

Expand Down

0 comments on commit 598d7dc

Please sign in to comment.