Skip to content

[FileManager] _attributesOfItem: use creationDate from the stat extension in NSURL #2905

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

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

finagolfin
Copy link
Member

rather than repeating that logic

The last case in stat.creationDate also works for Android.

Note that it uses st_birthtimespec instead on Darwin, let me know if that makes a difference. @compnerd, this pull redoes #2884 because it didn't work on Android and to reuse the existing logic, let me know what you think.

…sion in

NSURL rather than repeating that logic

The last case in stat.creationDate also works for Android.
@spevans
Copy link
Contributor

spevans commented Oct 17, 2020

looking at the manpage for stat(2) on macOS, st_birthtimespec does look like the better choice:

 struct timespec st_ctimespec;     /* time of last status change */
 struct timespec st_birthtimespec; /* time of file creation(birth) */

@spevans
Copy link
Contributor

spevans commented Oct 18, 2020

@swift-ci test

@compnerd
Copy link
Member

Could you please ensure that this still works on Windows? If it does, LGTM.

@finagolfin
Copy link
Member Author

I don't use Windows so I can't ensure it, but the Windows case being used now exactly matches the else case you added, so it should be fine.

@compnerd
Copy link
Member

I was more worried about the property not existing and this failing to build. Seems that the property is present. LGTM.

@compnerd
Copy link
Member

Thanks for the cleanup @buttaface!

@compnerd compnerd merged commit ff29c5b into swiftlang:main Oct 20, 2020
@finagolfin finagolfin deleted the create branch October 20, 2020 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants