avoid setting last modified, if it is zero

This commit is contained in:
tibbi 2022-05-21 16:55:09 +02:00
parent e0671f01ce
commit 795a4ae3e3
2 changed files with 8 additions and 2 deletions

View file

@ -320,7 +320,10 @@ class CopyMoveTask(
private fun updateLastModifiedValues(source: FileDirItem, destination: FileDirItem) {
copyOldLastModified(source.path, destination.path)
File(destination.path).setLastModified(File(source.path).lastModified())
val lastModified = File(source.path).lastModified()
if (lastModified != 0L) {
File(destination.path).setLastModified(lastModified)
}
}
private fun deleteSourceFile(source: FileDirItem) {

View file

@ -38,7 +38,10 @@ fun BaseSimpleActivity.copySingleFileSdk30(source: FileDirItem, destination: Fil
return if (source.size == copiedSize && getDoesFilePathExist(destination.path)) {
if (baseConfig.keepLastModified) {
copyOldLastModified(source.path, destination.path)
File(destination.path).setLastModified(File(source.path).lastModified())
val lastModified = File(source.path).lastModified()
if (lastModified != 0L) {
File(destination.path).setLastModified(lastModified)
}
}
true
} else {