ASL
Loading...
Searching...
No Matches
Path Class Reference

Detailed Description

This class is a utility to process file system path names.

Path path = "models/box.step";
String basename = path.nameNoExt(); // -> "box"
String newname = path.noExt() + ".stl"; // -> "models/box.stl"
if(path.hasExtension("STP|STEP")) {...} // -> true (case insensitive test for extensions)
newpath = path.directory() / "subdir" / basename + ".json"; -> "/models/subdir/box.json"
An Array is a contiguous and resizable array of any type of elements.
Definition Array.h:69
This class is a utility to process file system path names.
Definition Path.h:28
String nameNoExt() const
Returns this path's file name without its extension.
Definition Path.h:91
bool hasExtension(const String &exts) const
Returns true if this path's extension is any of those given (separated by '|'), case-insensitively.
Path noExt() const
Returns this path without its extension.
Path directory() const
Returns the directory containing this path (without a trailing '/')
String represents a character string that behaves similarly to JavaScript strings in that it can be c...
Definition String.h:126

#include <Path.h>

Public Member Functions

 Path (const String &p)
 Constructs a path with a string (turns backslashes into slashes).
 
bool operator== (const String &s) const
 Tests if this path is equal to the given string (ignoring backslash vs slash).
 
bool equals (const Path &p) const
 Tests if this path refers to the same as p as absolute paths.
 
String name () const
 Returns the path file name (without its directory)
 
String extension () const
 Returns the path extension (what follows the last dot)
 
bool hasExtension (const String &exts) const
 Returns true if this path's extension is any of those given (separated by '|'), case-insensitively.
 
bool hasDir () const
 Returns true if this path has a parent directory, not just a file name.
 
Path directory () const
 Returns the directory containing this path (without a trailing '/')
 
Path noExt () const
 Returns this path without its extension.
 
String nameNoExt () const
 Returns this path's file name without its extension.
 
Path absolute () const
 Returns the absolute path corresponding to this, possibly relative, path.
 
bool isAbsolute () const
 Returns true if this is an absolute path.
 
bool hasDirectory () const
 Returns true if this has a parent directory and is not just a name.
 
PathremoveDDots ()
 Removes double dots in a path by stepping up one directory each time.
 
Path operator+ (const String &s) const
 Concatenates this path with a suffix.
 
Path operator/ (const String &p) const
 Concatenates this path with another, and removes possible double slashes.
 

The documentation for this class was generated from the following file: