96 :
path((const unsigned char*)p, (const unsigned char*)p+strlen(p))
104 :
path(p, p+wcslen(p))
110 :
path((const unsigned char*)s.c_str(), (const unsigned char*)s.c_str()+s.length())
140 std::filesystem::path fileSystemPath()
const
142 return std::filesystem::path(
path);
162 std::string spath(
path.begin(),
path.end());
200 if(idxSlash == String::npos)
202 return path.substr(0, idxSlash);
208 if(idxSlash == String::npos)
210 return path.substr(idxSlash+1);
216 const size_t idxDot = filename.
string().find_last_of(
'.');
217 if(idxDot == String::npos)
219 return filename.
string().substr(0, idxDot);
226 const size_t idxDot = filename.
string().find_last_of(
'.');
227 if(idxDot == String::npos)
229 return filename.
string().substr(idxDot);
245 if(rhs.
path.find((ret.
separator ==
'/')?
'\\' :
'/') != String::npos)
270 const size_t idx = ret.
path.rfind(other.
path);
271 if(idx == String::npos)
274 return path.substr(0, idx);
287 const size_t idxBackslash =
path.find(
'\\');
289 if(
path.find(
'/') != String::npos && idxBackslash != String::npos)
296 separator = (idxBackslash == String::npos)?
'/' :
'\\';
332 return m_StringHash(path.
string());
std::string string8() const
Return a UTF-8 version of the path, in a human-readable but potentially lossy form.
Definition: path.h:157
void PrintToDebugOutput() const
Definition: path.h:280
wchar_t separator
Definition: path.h:308
Path(const Path &p)
Definition: path.h:89
void DetectSeparator()
Definition: path.h:285
bool IsDirectory() const
Definition: path.h:190
bool operator!=(const Path &rhs) const
Definition: path.h:185
Path ChangeExtension(Path extension) const
Definition: path.h:232
Path(const wchar_t *p)
Definition: path.h:103
bool empty() const
Definition: path.h:128
Path operator/(Path rhs) const
Definition: path.h:237
bool operator==(const Path &rhs) const
Definition: path.h:180
Path(const char *p)
Definition: path.h:95
std::wstring String
Definition: path.h:82
Path Filename() const
Definition: path.h:205
static Status Validate(String::value_type c)
Definition: path.cpp:99
Path Extension() const
Definition: path.h:223
Path BeforeCommon(Path other) const
Return the path before the common part of both paths.
Definition: path.h:260
Path(const std::wstring &s)
Definition: path.h:115
Path Basename() const
Definition: path.h:213
Path & operator=(const Path &rhs)
Definition: path.h:121
bool operator<(const Path &rhs) const
Definition: path.h:175
String path
Definition: path.h:299
const String & string() const
Definition: path.h:146
Path Parent() const
Definition: path.h:197
Path()
Definition: path.h:84
Path(const std::string &s)
Definition: path.h:109
void debug_printf(const char *fmt,...)
write a formatted string to the debug channel, subject to filtering (see below).
Definition: debug.cpp:143
#define DEBUG_WARN_ERR(status)
display the error dialog with text corresponding to the given error code.
Definition: debug.h:326
const Status PATH_CHARACTER_ILLEGAL
Definition: path.h:52
const Status PATH_MIXED_SEPARATORS
Definition: path.h:55
const Status PATH_NOT_FOUND
Definition: path.h:54
const Status PATH_CHARACTER_UNSAFE
Definition: path.h:53
const Status OK
Definition: status.h:388
Definition: ShaderDefines.cpp:31
static std::wostream & operator<<(std::wostream &s, const Path &path)
Definition: path.h:311
bool path_is_subpath(const wchar_t *s1, const wchar_t *s2)
is s2 a subpath of s1, or vice versa? (equal counts as subpath)
Definition: path.cpp:51
static std::wistream & operator>>(std::wistream &s, Path &path)
Definition: path.h:317
const wchar_t * path_name_only(const wchar_t *path)
Get the path component of a path.
Definition: path.cpp:85
i64 Status
Error handling system.
Definition: status.h:173
std::size_t operator()(const Path &path) const
Definition: path.h:330
std::hash< std::wstring > m_StringHash
Definition: path.h:336
std::string utf8_from_wstring(const std::wstring &src, Status *err)
opposite of wstring_from_utf8
Definition: utf8.cpp:212
std::wstring wstring_from_utf8(const std::string &src, Status *err)
convert UTF-8 to a wide string (UTF-16 or UCS-4, depending on the platform's wchar_t).
Definition: utf8.cpp:229