QSaveFile is recommended for atomic writes to the filesystem. How does it work?
Does QSaveFile::commit() fsync() the file to the filesystem?
QSaveFile is recommended for atomic writes to the filesystem. How does it work?
Does QSaveFile::commit() fsync() the file to the filesystem?
Copyright © 2021 Jogjafile Inc.
Yes, and no.
It writes to a temporary file, fsync()-it, and then renames it to the desired filename. But the rename is not fsync()-ed. So in case of a power loss, the new file will not take place until the OS decides to write.
My solution is to call this after commit(): (linux only)