Tracking Issue for windows_change_time · Issue #121478 · rust-lang/rust (original) (raw)

In Windows, there's a field in FILE_BASIC_INFO called ChangeTime that tracks when file metadata is changed, such as renaming, file attributes, etc.

Currently, this property isn't included in the ::sys::windows::fs::FileAttr implementation, but is available in the c::FILE_BASIC_INFO impl.

Last write time (which is currently provided) is the last time the data stream changed, and this value represents a different time value.

source

This change adds a method change_time() to the MetadataExt trait in order to provide this value.

Public API

fn windows_change_time() { let meta = std::fs::metadata("example.txt").unwrap();

// Returns Option<u64> since this is only available if FILE_BASIC_INFO is the backing type of `.inner()`
let change_time = meta.change_time();

}

Steps / History

Unresolved Questions

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html