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

Make FileMode._os public #3809

Merged
merged 1 commit into from
Jul 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .release-notes/mode-os.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Make FileMode._os public

FileMode has always had a private method for getting an integer representation of the file mode. However, it was private and only available for use within the `files` package.

It is now public as `FileMode.os`.
Copy link
Member

Choose a reason for hiding this comment

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

os is kind of a weird name for this - as a private method that didn't matter much, but now that it's public, it kind of does. I'd kind of expect os to return me something that tells what operating system the filesystem is running within, as little sense as that may make.

I might have preferred something else, though my night-weary brain is unsure what the right thing to call it would be. Maybe just u32?

2 changes: 1 addition & 1 deletion packages/files/_file_des.pony
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ primitive _FileDes
ifdef windows then
path.chmod(mode)
else
@fchmod(fd, mode._os()) == 0
@fchmod(fd, mode.os()) == 0
end

fun chown(fd: I32, path: FilePath, uid: U32, gid: U32): Bool =>
Expand Down
2 changes: 1 addition & 1 deletion packages/files/directory.pony
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class Directory
let path' = FilePath(path, target, path.caps)?

ifdef linux or bsd then
0 == @fchmodat(_fd, target.cstring(), mode._os(), I32(0))
0 == @fchmodat(_fd, target.cstring(), mode.os(), I32(0))
else
path'.chmod(mode)
end
Expand Down
2 changes: 1 addition & 1 deletion packages/files/file.pony
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class File
_errno = FileError
else
var flags: I32 = @ponyint_o_rdwr()
let mode = FileMode._os() // default file permissions
let mode = FileMode.os() // default file permissions
if not path.exists() then
if not path.caps(FileCreate) then
_errno = FileError
Expand Down
2 changes: 1 addition & 1 deletion packages/files/file_mode.pony
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class FileMode
any_write = false
any_exec = false

fun _os(): U32 =>
fun os(): U32 =>
"""
Get the OS specific integer for a file mode. On Windows, if any read flag
is set, the path is made readable, and if any write flag is set, the path
Expand Down
2 changes: 1 addition & 1 deletion packages/files/file_path.pony
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ class val FilePath
return false
end

let m = mode._os()
let m = mode.os()

ifdef windows then
0 == @_chmod(path.cstring(), m)
Expand Down