Open anatol opened 1 year ago
I was about to say “can’t you os.Chtimes() before calling CloseAtomicallyReplace()?”, but I think the problem might be that the t.Sync() and/or t.Close() that CloseAtomicallyReplace calls change the modification time themselves, so the Chtimes needs to happen just above https://github.com/google/renameio/blob/0450d4d46d68d9e2184fe3a7cea9ec500b37a68a/tempfile.go#L165
Sounds reasonable, pull requests welcome. We probably need to make both atime and mtime configurable in a single option as that’s what os.Chtimes() wants.
In some situations I need to set modification time for the new file.
Having an Option
WithPermissions
that takes provided
time
into account and updates the resulting file would make it possible.