diff --git a/.release-notes/mode-os.md b/.release-notes/mode-os.md new file mode 100644 index 0000000000..4cd2205849 --- /dev/null +++ b/.release-notes/mode-os.md @@ -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`. diff --git a/packages/files/_file_des.pony b/packages/files/_file_des.pony index a9f6cb4d8f..5d9e539f55 100644 --- a/packages/files/_file_des.pony +++ b/packages/files/_file_des.pony @@ -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 => diff --git a/packages/files/directory.pony b/packages/files/directory.pony index bf195448a5..a253a5b115 100644 --- a/packages/files/directory.pony +++ b/packages/files/directory.pony @@ -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 diff --git a/packages/files/file.pony b/packages/files/file.pony index 9e09bd29ab..b4c2412c46 100644 --- a/packages/files/file.pony +++ b/packages/files/file.pony @@ -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 diff --git a/packages/files/file_mode.pony b/packages/files/file_mode.pony index f862dc0d26..41ab59096b 100644 --- a/packages/files/file_mode.pony +++ b/packages/files/file_mode.pony @@ -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 diff --git a/packages/files/file_path.pony b/packages/files/file_path.pony index 9eeb42154a..7d2cd78f2d 100644 --- a/packages/files/file_path.pony +++ b/packages/files/file_path.pony @@ -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)