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

os: add os.stat() and helpers #20739

Merged
merged 6 commits into from Feb 7, 2024
Merged

os: add os.stat() and helpers #20739

merged 6 commits into from Feb 7, 2024

Conversation

syrmel
Copy link
Contributor

@syrmel syrmel commented Feb 6, 2024

Adds a platform-agnostic Stat struct and os.stat() function to provide stat() functionality as it is found in other languages and to make it possible to simplify other functions within os like file_size() by consistently using Stat.

Helper functions for the Stat struct have been added to make working with stat info dev-friendly, specifically get_{a|c|m}time() to return a Time struct instead of just the unix epoch and get_filetype() and get_mode() which use existing os structs (FileType, FilePermissions, and FileMode).

Handling of stat-related info is quite different in Windows than in *nix; the required C code has been split up accordingly.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

@spytheman spytheman merged commit 205f2dd into vlang:master Feb 7, 2024
48 checks passed
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.

None yet

2 participants