Skip to content

Commit

Permalink
fixes #892
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed May 7, 2024
1 parent dd693b7 commit 0e5062a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Expand Up @@ -501,6 +501,7 @@ private void copyFiles(
file.isDirectory());
try {
copyFiles(file, destFile, progressHandler);
destFile.setLastModified(file.lastModified());
} catch (IOException e) {
throw new IllegalStateException(e); // throw unchecked exception, no throws needed
}
Expand All @@ -522,6 +523,7 @@ private void copyFiles(
AppConfig.toast(c, c.getString(R.string.copy_low_memory));
},
ServiceWatcherUtil.UPDATE_POSITION);
targetFile.setLastModified(sourceFile.lastModified());
}
}
}
Expand Down
13 changes: 11 additions & 2 deletions app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java
Expand Up @@ -39,6 +39,8 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URLDecoder;
import java.nio.file.Files;
import java.nio.file.attribute.FileTime;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
Expand Down Expand Up @@ -1440,8 +1442,15 @@ public Boolean execute(@NonNull Session session) throws IOException {
// do nothing
return true;
} else {
File f = getFile();
return f.setLastModified(date);
if (getFile().setLastModified(date)) return true;

try {
Files.setLastModifiedTime(getFile().toPath(), FileTime.fromMillis(date));
return true;
} catch (IOException e) {
LOG.error("Files#setLastModifiedTime", e);
return false;
}
}
}

Expand Down

0 comments on commit 0e5062a

Please sign in to comment.