How does Mp3tag update files?


When Mp3tag is updating tags within a file, does it directly overwrite the file, which (potentially) could damage the file if Mp3tag crashes during the write? Or, does it write out a temporary file, then delete the old file and rename the new one, which would protect the file in case of a crash during an update operation?


If the tag is appended to the file (ID3v1 and APEv2), it simply writes after EOF. If the tag is prepended like ID3v2, it creates a new file containing the tag, then appends the content of the original file, deletes the original file and finally renames the new file.