-
Notifications
You must be signed in to change notification settings - Fork 61
Description
There is no specific function to change only the atime
for links. It could be nice if set_times
was public, as this may be the only function you need. But when using set_symlink_file_times
you must first get the current link metadata, which is also inefficient, and then change both the mtime
and the atime
, providing the one you don't want to change from the metadata. Specific functions like set_file_atime
provide a None
to the relevant FileTime
in set_times
, which then converts it to an OS-specific UTIME_OMIT
for the system call or whatever in Windows. Unlike in Windows implementation's set_file_handle_times
corresponding function, though, which does accept Option<FileTime>
and is public, in Linux using set_times
sin't an option.
When I try to set atime
only by providing mtime
from the original link's metadata with set_symlink_file_times
, the link's 'atime' becomes the current system time on Debian 12 x86-64 default ext4 filesystem. It works well for me the other way round, though, I am not sure why.
Proposed solutions:
- Add specific
set_symlink_file_atime
andset_symlink_file_mtime
to both Windows and Linux implementations. - Remove the
set_symlink_file_times
entirely and add a flag likefollow_links
to the normal file functions likeset_file_atime
. - Make
set_times
public, like theset_file_handle_times
in Windows.