Support for preserving file identity (inode/fileIndex).

Merged
#41 · Created  · Last updated

Merged pull request

Merged in h_schreiber/jaudiotagger/Preserve_CreationDate (pull request #41)

a06b2d5·Author: ·Closed by: ·2016-09-09

Description

The general AudioFileWriter behavior is, that a temp file is created with the new contents, the original file is moved out of the way and then the temp file is moved in its place. This has the advantage that a copy operation may be avoided, if both the temp file and the original file live in the same filesystem.

Unfortunately, this behavior creates a completely new file. Some applications actually have the capability of remembering the file identity (i.e. the inode on Unix and fileIndex on Windows). These applications are confused, when the file identity suddenly changes.

The proposed fix allows the user to simply write over the existing original file instead of moving it out of the way and replacing it with the temp file. This preserves the file's identity.

The new behavior can be turned on/off via a switch in TagOptionSingleton, as it's probably not desirable for everyone. By default it is turned off.

The pull request also contains a small addition for the default behavior: If possible, the creation date is adjusted to mirror the original file. This does not work on all file systems, but fails silently (with a log message), if it does not.

0 attachments

0 comments

Loading commits...