-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Simple implementation of chmod(path, mode) #7590
Conversation
@@ -164,6 +165,11 @@ end | |||
@windowsxp_only symlink(p::String, np::String) = | |||
error("WindowsXP does not support soft symlinks") | |||
|
|||
function chmod(p::String, mode::Integer) | |||
err = ccall(:jl_fs_chmod, Int32, (Ptr{Uint8}, Cint), bytestring(p), mode) |
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 don't think you need to call bytestring here.
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.
utf8 filename?
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.
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.
Ah, there you go. Was going off the example of every other ccall in base/fs.jl
that takes a string, looks like those could all be cleaned up and remove the bytestring
then.
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.
Why would bytestring not be needed? The parameter type is String
!
💯 been wanting this for a while |
currently only integer modes, can do string modes like +x later fixes JuliaLang#7574
Rebased on latest master, and added a |
This looks great to me. Thanks for tackling this, @tkelman. @jakebolewski it might be interesting to try out this branch and see if it fixes your libgit2 issues before merging, but for the record, I think this is ready to merge. |
Simple implementation of chmod(path, mode)
I'm hitting the button on this now that master's open for 0.4. |
currently only integer modes, can do string modes like +x later
fixes #7574
Interestingly on Windows, it looks like libuv ignores everything you ask for except the
0o200
bit, and the returnedfilemode()
ends up either0o444
or0o666
.