Skip to content

Tracking Issue for windows_change_time #121478

New issue

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

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

Already on GitHub? # to your account

Open
1 of 3 tasks
juliusl opened this issue Feb 22, 2024 · 3 comments
Open
1 of 3 tasks

Tracking Issue for windows_change_time #121478

juliusl opened this issue Feb 22, 2024 · 3 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@juliusl
Copy link
Contributor

juliusl commented Feb 22, 2024

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

  • None yet.

Footnotes

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

@juliusl juliusl added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Feb 22, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 25, 2024
…ross35

fix: compilation issue w/ refactored type

Fixes a compilation issue related to rust-lang#121478
@tgross35
Copy link
Contributor

The docs currently say:

This will return None if the Metadata instance was not created using the FILE_BASIC_INFO type.

Could you reword this to clarify what is required for somebody using Rust's APIs? It isn't clear how somebody may or may not wind up with a FILE_BASIC_INFO, since that type isn't mentioned anywhere.

rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 26, 2024
Rollup merge of rust-lang#128211 - juliusl:pr/align-change-time, r=tgross35

fix: compilation issue w/ refactored type

Fixes a compilation issue related to rust-lang#121478
@juliusl
Copy link
Contributor Author

juliusl commented Jul 26, 2024

@tgross35 FILE_BASIC_INFO is a windows api struct and actually seeing the alternative implementation I think we could align both implementations so that I can return a value in both cases, see -- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex#remarks

I'll tinker and see if I can draft something

@tgross35
Copy link
Contributor

@tgross35 FILE_BASIC_INFO is a windows api struct

As in, to non-uwp users this only comes up if they are using the windows crate? If that is accurate then it would just be good to mention, I just couldn't figure out how this gets used. But...

and actually seeing the alternative implementation I think we could align both implementations so that I can return a value in both cases, see -- https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex#remarks

I'll tinker and see if I can draft something

that sounds even better, cool.

workingjubilee added a commit to workingjubilee/rustc that referenced this issue Sep 11, 2024
…links, r=ChrisDenton

maint: update docs for change_time ext and doc links

maint: update docs for change_time ext and doc links

Related: rust-lang#121478
r? tgross35
workingjubilee added a commit to workingjubilee/rustc that referenced this issue Sep 11, 2024
…links, r=ChrisDenton

maint: update docs for change_time ext and doc links

maint: update docs for change_time ext and doc links

Related: rust-lang#121478
r? tgross35
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 12, 2024
Rollup merge of rust-lang#130168 - juliusl:pr/fix-win-fs-change-time-links, r=ChrisDenton

maint: update docs for change_time ext and doc links

maint: update docs for change_time ext and doc links

Related: rust-lang#121478
r? tgross35
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Sep 12, 2024
…ChrisDenton

maint: update docs for change_time ext and doc links

maint: update docs for change_time ext and doc links

Related: rust-lang/rust#121478
r? tgross35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants