Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fd9efca authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

DownloadFileRemoteOperation: create target directory on the phone if missing

parent ca5dd59d
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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();