This class provides a convenient way of working with paths. It supports the common path formats:
- directory1/directory2/filename.extension
- directory1\directory2\filename.extension
Constructor
Variables
The directory.
This is the leading part of the path that is not part of the file name and the extension.
Does not end with a / or \ separator.
If the path has no directory, the value is null.
Methods
Static methods
staticaddTrailingSlash (path:String):String
Available on Neko, macOS, Linux, Windows
Adds a trailing slash to path, if it does not have one already.
If the last slash in path is a backslash, a backslash is appended to
path.
If the last slash in path is a slash, or if no slash is found, a slash
is appended to path. In particular, this applies to the empty String
"".
If path is null, the result is unspecified.
staticdirectory (path:String):String
Returns the directory of path.
If the directory is null, the empty String "" is returned.
If path is null, the result is unspecified.
staticextension (path:String):String
Available on Neko, Flash, macOS, Linux, Windows
Returns the extension of path.
If the extension is null, the empty String "" is returned.
If path is null, the result is unspecified.
staticisAbsolute (path:String):Bool
Available on Neko, macOS, Linux, Windows
Returns true if the path is an absolute path, and false otherwise.
staticjoin (paths:Array<String>):String
Available on Neko, macOS, Linux, Windows
Joins all paths in paths together.
If paths is empty, the empty String "" is returned. Otherwise the
paths are joined with a slash between them.
If paths is null, the result is unspecified.
staticnormalize (path:String):String
Available on Neko, macOS, Linux, Windows
Normalize a given path (e.g. make '/usr/local/../lib' to '/usr/lib').
Also replaces backslashes \ with slashes / and afterwards turns multiple slashes into a single one.
If path is null, the result is unspecified.
staticremoveTrailingSlashes (path:String):String
Available on Neko, macOS, Linux, Windows
Removes trailing slashes from path.
If path does not end with a / or \, path is returned unchanged.
Otherwise the substring of path excluding the trailing slashes or
backslashes is returned.
If path is null, the result is unspecified.
staticwithoutDirectory (path:String):String
Available on Neko, Android, iOS, macOS, Linux, HTML5, Windows
Returns the String representation of path without the directory.
If path is null, the result is unspecified.
staticwithoutExtension (path:String):String
Available on Neko, macOS, Linux, Windows
Returns the String representation of path without the file extension.
If path is null, the result is unspecified.