A FilePath represents a capability to access a path. The path will be represented as an absolute path and a set of capabilities for operations on that path.
class val FilePath
Create a new path. The caller must either provide the root capability or an existing FilePath.
If the root capability is provided, path' will be relative to the program's working directory. Otherwise, it will be relative to the existing FilePath, and the existing FilePath must be a prefix of the resulting path.
The resulting FilePath will have capabilities that are the intersection of the supplied capabilities and the capabilities on the parent.
new val create( base: (FilePath val | AmbientAuth val), path': String val, caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val = recover) : FilePath val^ ?
Create a temporary directory and returns a path to it. The directory's name will begin with prefix
. The caller must either provide the root capability or an existing FilePath.
If AmbientAuth is provided, pattern will be relative to the program's working directory. Otherwise, it will be relative to the existing FilePath, and the existing FilePath must be a prefix of the resulting path.
The resulting FilePath will have capabilities that are the intersection of the supplied capabilities and the capabilities on the base.
new val mkdtemp( base: (FilePath val | AmbientAuth val), prefix: String val = "", caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val = recover) : FilePath val^ ?
Internal constructor.
new val _create( path': String val, caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val) : FilePath val^
Absolute filesystem path.
Set of capabilities for operations on path
.
Return a new path relative to this one.
fun val join( path': String val, caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val = recover) : FilePath val ?
Walks a directory structure starting at this.
handler(dir_path, dir_entries)
will be called for each directory starting with this one. The handler can control which subdirectories are expanded by removing them from the dir_entries
list.
fun val walk( handler: WalkHandler ref, follow_links: Bool val = false) : None val
Return the equivalent canonical absolute path. Raise an error if there isn't one.
fun val canonical() : FilePath val ?
Returns true if the path exists. Returns false for a broken symlink.
fun val exists() : Bool val
Creates the directory. Will recursively create each element. Returns true if the directory exists when we're done, false if it does not. If we do not have the FileStat permission, this will return false even if the directory does exist.
fun val mkdir( must_create: Bool val = false) : Bool val
Remove the file or directory. The directory contents will be removed as well, recursively. Symlinks will be removed but not traversed.
fun val remove() : Bool val
Rename a file or directory.
fun box rename( new_path: FilePath val) : Bool val
Create a symlink to a file or directory.
fun box symlink( link_name: FilePath val) : Bool val
Set the FileMode for a path.
fun box chmod( mode: FileMode box) : Bool val
Set the owner and group for a path. Does nothing on Windows.
fun box chown( uid: U32 val, gid: U32 val) : Bool val
Set the last access and modification times of a path to now.
fun box touch() : Bool val
Set the last access and modification times of a path to the given values.
fun box set_time( atime: (I64 val , I64 val), mtime: (I64 val , I64 val)) : Bool val
© 2016-2018, The Pony Developers
© 2014-2015, Causality Ltd.
Licensed under the BSD 2-Clause License.
https://stdlib.ponylang.io/files-FilePath