crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.48k stars 1.62k forks source link

Docs are wrong for Dir.mkdir and mkdir_p #13466

Open jwoertink opened 1 year ago

jwoertink commented 1 year ago

Visiting the docs for Dir.mkdir_p https://crystal-lang.org/api/1.8.2/Dir.html#mkdir_p%28path%3APath%7CString%2Cmode%3D511%29%3ANil-class-method

I noticed it shows a default mode of 511

image

Although it says the default is 0o777. If we visit the source, it's correct:

https://github.com/crystal-lang/crystal/blob/1a43461bb87d8f27576b1695091cc83b94ecdcb1/src/dir.cr#L277-L284

So somehow the docs read 0o777 and convert it to 511? :thinking:

Blacksmoke16 commented 1 year ago

0o777 is the octal form of decimal 511, so it's technically correct, but seems the API docs are resolving it to its decimal form versus retaining the octal form.

straight-shoota commented 1 year ago

A trivial solution would be to use File::Permissions::All.