diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Filesystem.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Filesystem.java index 9cd692377..18e62b67e 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Filesystem.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Filesystem.java @@ -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(); }