From 72625e719d0e38f2e608f04ebfdb8351f43c773a Mon Sep 17 00:00:00 2001 From: "Sean T. Allen" Date: Sat, 17 Jul 2021 16:20:35 -0400 Subject: [PATCH] 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. I discovered this when writing a pure pony tar library and needed exactly the functionality of _os. This commit changes `_os` from private to public as `os` and updates its callers. --- .release-notes/mode-os.md | 5 +++++ packages/files/_file_des.pony | 2 +- packages/files/directory.pony | 2 +- packages/files/file.pony | 2 +- packages/files/file_mode.pony | 2 +- packages/files/file_path.pony | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .release-notes/mode-os.md 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)