mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-09 22:09:47 -04:00
Force and Restore source last modified timestamp only if it was (possibly) changed by writing xattr metadata
This commit is contained in:
parent
d194ebee73
commit
86391a7f78
@ -676,20 +676,22 @@ public class CmdlineOperations implements CmdlineInterface {
|
||||
if (matches != null) {
|
||||
for (Match<File, ?> match : matches) {
|
||||
if (match.getCandidate() != null) {
|
||||
File destination = log.get(match.getValue());
|
||||
File source = match.getValue();
|
||||
File destination = log.get(source);
|
||||
|
||||
if (destination != null && destination.isFile()) {
|
||||
// remember Last Modified date
|
||||
long timestamp = source.isFile() ? source.lastModified() : destination.lastModified();
|
||||
|
||||
// store xattr
|
||||
xattr.setMetaInfo(destination, match.getCandidate(), match.getValue().getName());
|
||||
|
||||
// restore Last Modified date
|
||||
destination.setLastModified(timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// preserve Last Modified date
|
||||
log.forEach((source, destination) -> {
|
||||
if (destination != null && destination.isFile() && source.exists()) {
|
||||
destination.setLastModified(source.lastModified());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected File nextAvailableIndexedName(File file) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user