Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting file accessed/modified timestamps #98246

Merged
merged 7 commits into from
Aug 1, 2022

Commits on Jul 15, 2022

  1. Support setting file accessed/modified timestamps

    Add `struct FileTimes` to contain the relevant file timestamps, since
    most platforms require setting all of them at once. (This also allows
    for future platform-specific extensions such as setting creation time.)
    
    Add `File::set_file_time` to set the timestamps for a `File`.
    
    Implement the `sys` backends for UNIX, macOS (which needs to fall back
    to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
    and WASI.
    joshtriplett committed Jul 15, 2022
    Configuration menu
    Copy the full SHA
    61b45c6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1ac8d5e View commit details
    Browse the repository at this point in the history
  3. Return an error if trying to set a file timestamp to 0 on Windows

    This would otherwise silently ignore the attempt, since 0 serves as a
    flag to not set a timestamp.
    joshtriplett committed Jul 15, 2022
    Configuration menu
    Copy the full SHA
    828b637 View commit details
    Browse the repository at this point in the history
  4. Also use fallback for futimens on Android

    futimens requires Android API level 19, and std still supports older API
    levels.
    joshtriplett committed Jul 15, 2022
    Configuration menu
    Copy the full SHA
    e387cff View commit details
    Browse the repository at this point in the history
  5. Don't fall back to futimes on Android; it needs a newer API level tha…

    …n futimens
    
    Just return `io::ErrorKind::Unsupported` instead.
    joshtriplett committed Jul 15, 2022
    Configuration menu
    Copy the full SHA
    3da1729 View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2022

  1. Stub out set_times to return unsupported on Redox

    Redox doesn't appear to support `UTIME_OMIT`, so we can't set file times
    individually.
    joshtriplett committed Jul 22, 2022
    Configuration menu
    Copy the full SHA
    11d9be6 View commit details
    Browse the repository at this point in the history

Commits on Jul 30, 2022

  1. Configuration menu
    Copy the full SHA
    f8061dd View commit details
    Browse the repository at this point in the history