-
Notifications
You must be signed in to change notification settings - Fork 198
feat: creating and removing empty directories #1011
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
Conversation
|
Hey @wassup05. Thanks for the PR. Great work!
|
I think it's fine @sebastian-mutz, doing that would kind of clutter the example I feel, and this is how it's been handled in some other examples as well like here and here |
Makes sense. Then it's best to keep it consistent. |
|
Concerning the PythonComplete docs here: https://docs.python.org/3/library/os.html#os.mkdir
GolangGolang does it in a different way by creating a portable custom
Reference: https://pkg.go.dev/os#FileMode, https://pkg.go.dev/os#Mkdir RustRust seems to have dropped this argument completely and uses default permissions |
|
Regarding the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR update, @wassup05! Looks good. I left some minor comments for more clarity and comment style consistency.
sebastian-mutz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a last look at the code itself later, but looks good and works for me so far.
sebastian-mutz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @wassup05. The PR LGTM as it is. Thanks!
perazz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @wassup05, thank you for this PR. I only have one tiny comment left before I think this is ready to merge.
|
In absence of further comments, and with two approvals, I will go ahead and merge this one. |
User facing functions added are
make_directory (path, mode, err)(modeargument only for Unix systems)remove_directory (path, err)/or\.CRTfunctionsmkdir, rmdir,_mkdir, _rmdiron Unix and Windows respectively.strerrorhas been included as a private helper to provide helpful error messages.state_typeis used for error handling.Side note:
make_directorycould have alogicalargumentrecursivewhich would work likemkdir -pbut that would require path manipulation especiallydir_namefrom #999Do let me know your thoughts.