3 ms·
Yeah even if it didn't, I mean, you could still save to a temp file, delete the old one then move. Not atomic, but it's safer than just doing what they were doi
by raverbashing 4y ago
Yeah even if it didn't, I mean, you could still save to a temp file, delete the old one then move. Not atomic, but it's safer than just doing what they were doing
(or just pad the rest with zeros worse case)
- wongarsu 4y agoIf you really want to, you can make it atomic by using the Transactional NTFS API [1]. Though I suppose you need a non-atomic fallback in case the file is not on an NTFS volume. [1] https://learn.microsoft.com/en-us/windows/win32/fileio/when-to-use-transactional-ntfs https://learn.microsoft.com/en-us/windows/win32/fileio/when-...
- Rimintil 4y agoTxF is deprecated: https://learn.microsoft.com/en-us/windows/win32/fileio/about-transactional-ntfs https://learn.microsoft.com/en-us/windows/win32/fileio/about...
- wongarsu 4y agoTechnically it isn't deprecated, just discouraged. Note how the page you linked doesn't contain the word "deprecated", and the "alternatives" page linked from that notice states in the introduction that they are considering deprecating it in a future version of Windows. Given that this notice seems to exist since at least 2012, and neither Windows 10 nor 11 deprecated it, the TxF API will probably outlive whatever software you're writing today.
- deleted 4y ago[deleted]
- Rimintil 4y agoI'm not sure what developer would start a new project using TxF when the vendor is stating "we want to remove this", "don't use this feature", "here are alternatives". It's deprecated in all but name only.