MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / Path

Class Path

Engine/source/core/util/path.h:38–136  ·  view source on GitHub ↗

FileSystem filename representation. Filenames has the following form: "root:path/file.ext" @ingroup UtilString

Source from the content-addressed store, hash-verified

36/// Filenames has the following form: "root:path/file.ext"
37/// @ingroup UtilString
38class Path
39{
40public:
41 enum Separator
42 {
43#if defined(TORQUE_OS_WIN)
44 OsSeparator = '\\'
45#else
46 OsSeparator = '/'
47#endif
48 };
49
50 Path()
51 : mIsDirtyFileName( true ),
52 mIsDirtyPath( true )
53 {
54 }
55
56 Path( const char *file )
57 : mIsDirtyFileName( true ),
58 mIsDirtyPath( true )
59 {
60 _split(file);
61 }
62
63 Path( const String &file )
64 : mIsDirtyFileName( true ),
65 mIsDirtyPath( true )
66 {
67 _split(file);
68 }
69
70 Path& operator = ( const String &file ) { _split(file); mIsDirtyPath = mIsDirtyFileName = true; return *this; }
71 operator String() const { return getFullPath(); }
72
73 bool operator == (const Path& path) const { return getFullPath().equal(path.getFullPath()); }
74 bool operator != (const Path& path) const { return !(*this == path); }
75 bool operator != (const String& path) const { return !(getFullPath().equal(path)); }
76
77 bool isEmpty() const { return getFullPath().isEmpty(); }
78
79 /// Join two path or file name components together.
80 static String Join(const String&,String::ValueType,const String&);
81
82 /// Replace all '\' with '/'
83 static String CleanSeparators( String path );
84
85 /// Remove "." and ".." relative paths.
86 static String CompressPath( String path );
87
88 /// Take two paths and return the relative path between them.
89 static Path MakeRelativePath( const Path &makeRelative, const Path &relativeTo, U32 mode = String::NoCase );
90
91 const String& getRoot() const { return mRoot; }
92 const String& getPath() const { return mPath; }
93 const String& getFileName() const { return mFile; }
94 const String& getExtension() const { return mExt; }
95

Callers 2

mapFromMethod · 0.50
mapFSPathMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected