Support Forum G3D Web Page |
Parsing of file system paths. More...
Static Public Member Functions | |
static String | base (const String &path) |
Returns everything between the right-most slash and the following '. More... | |
static String | baseExt (const String &path) |
Returns everything to the right of the last slash (or, on Windows, the last ':') More... | |
static String | canonicalize (String x) |
Convert all slashes to '/'. More... | |
static String | concat (const String &a, const String &b) |
Appends file onto dirname, ensuring a / if needed. More... | |
static bool | containsWildcards (const String &p) |
Returns true if '*' or '?' appear in the filename. More... | |
static String | expandEnvironmentVariables (const String &path) |
Replaces $VAR and patterns with the corresponding environment variable. More... | |
static String | ext (const String &path) |
Returns everything to the right of the last '. More... | |
static bool | isLegalFilename (const String &f, size_t maxLength=100000) |
Performs same check as makeLegalFilename but returns true is legal false if not legal. More... | |
static bool | isRoot (const String &f) |
Returns true if f specifies a path that parses as root of the filesystem. More... | |
static String | makeLegalFilename (const String &f, size_t maxLength=100000) |
Replaces characters that are illegal in a filename with legal equivalents. More... | |
static String | mangle (const String &filename) |
Converts filename into a legal filename by escaping potentially dangerous characters to have in a filename. More... | |
static bool | matches (const String &path, const String &pattern, bool caseSensitive=true) |
Returns true if path matches pattern, with standard filesystem wildcards. More... | |
static String | parent (const String &path) |
Returns everything to the left of the right-most slash. More... | |
static void | parse (const String &filename, String &drive, Array< String > &path, String &base, String &ext) |
Parses a filename into four useful pieces. More... | |
static String | removeTrailingSlash (const String &f) |
Removes the trailing slash unless f is a filesystem root. More... | |
static String | unMangle (const String &mangledFilename) |
unmangles filenames More... | |
Parsing of file system paths.
None of these routines touch the disk–they are purely string manipulation.
In "/a/b/base.ext",
Returns everything between the right-most slash and the following '.
'
Returns everything to the right of the last slash (or, on Windows, the last ':')
Appends file onto dirname, ensuring a / if needed.
|
static |
Returns true if '*' or '?' appear in the filename.
Replaces $VAR
and patterns with the corresponding environment variable.
Throws String if the environment variable is not defined.
Returns everything to the right of the last '.
'
|
static |
Performs same check as makeLegalFilename but returns true is legal false if not legal.
|
static |
Returns true if f specifies a path that parses as root of the filesystem.
On OS X and other Unix-based operating systems, "/" is the only root. On Windows, drive letters and shares are roots, e.g., "c:\", "\\foo\". Does not check on Windows to see if the root is actually mounted or a legal drive letter–this is a purely string based test.
|
static |
Replaces characters that are illegal in a filename with legal equivalents.
Converts filename into a legal filename by escaping potentially dangerous characters to have in a filename.
|
static |
Returns true if path matches pattern, with standard filesystem wildcards.
Returns everything to the left of the right-most slash.
|
static |
Parses a filename into four useful pieces.
Examples:
c:\a\b\d.e
root = "c:\\" path = "a" "b" base = "d" ext = "e"
/a/b/d.e root = "/" path = "a" "b" base = "d" ext = "e"
/a/b root = "/" path = "a" base = "b" ext = "e"
Removes the trailing slash unless f is a filesystem root.