Operations on a directory.
The directory-relative functions (open, etc) use the *at interface on FreeBSD and Linux. This isn't available on OS X prior to 10.10, so it is not used. On FreeBSD, this allows the directory-relative functions to take advantage of Capsicum.
class ref Directory
This will raise an error if the path doesn't exist or it is not a directory, or if FileRead or FileStat permission isn't available.
new ref create( from: FilePath val) : Directory ref^ ?
Internal constructor. Capsicum rights are already set by inheritence.
new iso _relative( path': FilePath val, fd': I32 val) : Directory iso^
This is the filesystem path locating this directory on the file system and an object capability granting access to operate on this directory.
The entries will include everything in the directory, but it is not recursive. The path for the entry will be relative to the directory, so it will contain no directory separators. The entries will not include "." or "..".
fun box entries() : Array[String val] iso^ ?
Open a directory relative to this one. Raises an error if the path is not within this directory hierarchy.
fun box open( target: String val) : Directory iso^ ?
Creates a directory relative to this one. Returns false if the path is not within this directory hierarchy or if FileMkdir permission is missing.
fun box mkdir( target: String val) : Bool val
Open for read/write, creating if it doesn't exist, preserving the contents if it does exist.
fun box create_file( target: String val) : File iso^ ?
Open for read only, failing if it doesn't exist.
fun box open_file( target: String val) : File iso^ ?
Return a FileInfo for this directory. Raise an error if the fd is invalid or if we don't have FileStat permission.
fun box info() : FileInfo val ?
Set the FileMode for this directory.
fun box chmod( mode: FileMode box) : Bool val
Set the owner and group for this directory. Does nothing on Windows.
fun box chown( uid: U32 val, gid: U32 val) : Bool val
Set the last access and modification times of the directory to now.
fun box touch() : Bool val
Set the last access and modification times of the directory to the given values.
fun box set_time( atime: (I64 val , I64 val), mtime: (I64 val , I64 val)) : Bool val
Return a FileInfo for some path relative to this directory.
fun box infoat( target: String val) : FileInfo val ?
Set the FileMode for some path relative to this directory.
fun box chmodat( target: String val, mode: FileMode box) : Bool val
Set the FileMode for some path relative to this directory.
fun box chownat( target: String val, uid: U32 val, gid: U32 val) : Bool val
Set the last access and modification times of the directory to now.
fun box touchat( target: String val) : Bool val
Set the last access and modification times of the directory to the given values.
fun box set_time_at( target: String val, atime: (I64 val , I64 val), mtime: (I64 val , I64 val)) : Bool val
Link the source path to the link_name, where the link_name is relative to this directory.
fun box symlink( source: FilePath val, link_name: String val) : Bool val
Remove the file or directory. The directory contents will be removed as well, recursively. Symlinks will be removed but not traversed.
fun box remove( target: String val) : Bool val
Rename source (which is relative to this directory) to target (which is relative to the to
directory).
fun box rename( source: String val, to: Directory box, target: String val) : Bool val
Close the directory.
fun ref dispose() : None val
Close the file descriptor.
fun box _final() : None val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/files-Directory