-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Win: add Crystal::System::DirHandle #4903
Conversation
Alright, so in the other PR it is decided to keep How are we feeling about efficiency of these abstractions? A class wrapping a class that ultimately just stores a pointer doesn't seem right. |
if LibC.mkdir(path.check_no_null_byte, mode) == -1 | ||
raise Errno.new("Unable to create directory '#{path}'") | ||
end | ||
Crystal::System::DirHandle.mkdir(path, mode) | ||
0 |
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.
Not exactly related to this pr, but why does ˋmkdirˋ & ˋrmdirˋ returns ˋ0ˋ?
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 know, but in spec there is
Dir.mkdir(path, 0o700).should eq(0)
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.
Probably they should be marked as : Nil
for avoid leaking a useless return value
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 make another PR for it
I suppose, |
No no no, a subclass cannot work, that'll leak to documentation and other such details. You're saying it cannot be a struct (perhaps only ideologically, because technically mutable structs are fine) but I think for these internal objects we have to make an exception and think about them as an inherent part of the public objects. Make it a struct to keep efficiency at a sane level. Though I just argued in IRC that we could easily do without |
Why can't the methods that change between operating systems be implemented directly in |
Yes, |
This reverts commit 038e7ec. revert the previous commit
This now superseeded by #5447 |
#5447 was merged, closing this |
Moved platform specific things from
Dir
toCrystal::System::DirHandle
You can find
winapi.cr
andwinerror
in this PR #4832