diff --git a/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java b/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java index 6c9d6675e011080e294f5abc146803ae660155f5..654fde1d8bd4d60fd5d4f090dee4a4ba89420f9c 100644 --- a/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java +++ b/app/src/main/java/foundation/e/drive/operations/DownloadFileOperation.java @@ -148,7 +148,11 @@ public class DownloadFileOperation extends RemoteOperation { * @return true if success, false otherwise */ private boolean moveFileToRealLocation(File tmpFile, File targetFile) { + final File targetDir = targetFile.getParentFile(); + if (targetDir == null) return false; try { + if (!targetDir.exists()) targetDir.mkdirs(); + final Path copyResult = Files.copy(tmpFile.toPath(), targetFile.toPath(), REPLACE_EXISTING); if (copyResult.toFile().length() == tmpFile.length()) { tmpFile.delete();