namespace sys.core
class Path
A class implementing utility functions related to path manipulation and obtaining system paths.
As a general rule, it can handle inputs from all target platforms at the same time, but outputs are using the exact target specific conventions. This is a form of implicit path normalization.
static func GetFolder(path: String): String;
Returns a substring of a path representing the folder component.
Includes the platform specific folder separator as the last character in the result.
path | input path |
---|
the folder component
static func GetFolderNoSep(path: String): String;
Returns a substring of a path representing the folder component.
Includes the platform specific folder separator as the last character in the result.
path | input path |
---|
the folder component
static func GetName(path: String): String;
Returns a substring of a path representing the file name component, including the extension.
path | input path |
---|
file name and extension
static func GetNameIndex(path: String): PtrSize;
Returns the position of the file name in an input path, -1 if not found.
path | input path |
---|
file name position
static func GetTitle(path: String): String;
Returns a substring of a path representing the file name component, excluding the extension.
path | input path |
---|
the file name without extension
static func GetTitleIndex(path: String): PtrSize;
Returns the position of the file title in an input path, -1 if not found.
path | input path |
---|
file title position
static func GetExtension(path: String): String;
Returns a substring of a path representing the file extension component.
path | input path |
---|
file extension
static func GetExtensionIndex(path: String): PtrSize;
Returns the position of the file extension in an input path, -1 if not found.
path | input path |
---|
file extension position
static func GetParent(path: String): String;
REturns the parent folder of the input path. If the input path ends with a platform specific folder separator, it is treated as a folder. Otherwise it is treated as a file.
Folder separator character is included as the last character in the result.
path | input path |
---|
parent folder
static func IsRoot(path: String): Bool;
Checks if the input path is a root path.
path | input path |
---|
`true` if root
property CurrentFolder: String
Gets or sets the current folder.
Can fail if the process does not have permission to change the folder.
property ExeFileName: String; get;
Returns the full path of the currently executing program.
const DirSep;
The folder separating character for the current platform.
It is `DirSepWin` under Windows and `DirSepUnix` under POSIX systems.
const IgnoreCase;
A value that is `true` if the target platform ignores case in paths, like on Windows. It is `false` if paths do not ignore case, like under POSIX.
const DirSepWin;
The folder separator character under Windows ('\').
const DirSepUnix;
The folder separator character under Windows ('/').