Path extension type

This type supports a number of operations for inspecting a path, including breaking the path into its components, extracting the file name, determining whether the path is absolute, and so on.

on
Implemented types

Constructors

Path(String path)

Properties

hashCode int
The hash code for this object.
no setterinherited
path String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

ancestors() Iterable<Path>
canonicalize() Path
components() Iterable<Component>
display() String
String representation of the path
endsWith(Path other) bool
Determines whether other is a suffix of this.
exists() bool
Determines whether other is a suffix of this.
extension() String
Extracts the extension (without the leading dot) of self.file_name, if possible.
fileName() String
Returns the final component of the Path, if there is one.
filePrefix() Option<String>
Extracts the portion of the file name before the first "." -
fileStem() Option<String>
Extracts the portion of the file name before the last "." -
hasRoot() bool
Returns true if the Path has a root.
isAbsolute() bool
Returns true if the Path is absolute, i.e., if it is independent of the current directory.
isDir() bool
Returns true if the path exists on disk and is pointing at a directory. Does not follow links.
isFile() bool
Returns true if the path exists on disk and is pointing at a regular file. Does not follow links.
isRelative() bool
Returns true if the Path is relative, i.e., not absolute.
Returns true if the path exists on disk and is pointing at a symlink. Does not follow links.
iter() RIterator<String>
Produces an iterator over the path’s components viewed as Strings
join(Path other) Path
Creates an Path with path adjoined to this.
metadata() → Metadata
Queries the file system to get information about a file, directory, etc. Note: using this method results in the program no longer being able to compile to web.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parent() Option<Path>
Returns the Path without its final component, if there is one. This means it returns Some("") for relative paths with one component. Returns None if the path terminates in a root or prefix, or if it’s the empty string.
readDir() Result<ReadDir, IoError>
Returns an iterator over the entries within a directory. Note: using this method results in the program no longer being able to compile to web.
Reads a symbolic link, returning the file that the link points to.
startsWith(Path other) bool
Determines whether other is a prefix of this.
stripPrefix(Path prefix) Option<Path>
Returns a path that, when joined onto base, yields this. Returns None if prefix is not a subpath of base.
symlinkMetadata() Result<Metadata, IoError>
Returns the metadata for the symlink. Note: using this method results in the program no longer being able to compile to web.
toString() String
A string representation of this object.
inherited
withExtension(String extension) Path
Creates an Path like this but with the given extension.
withFileName(String fileName) Path
Creates an PathBuf like this but with the given file name.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isIoSupported() bool
Returns whether io operations are supported. If false, is currently running on the web.