3 namespace pfc {
namespace io {
namespace path {
13 if (split == ~0)
return path;
19 if (split == ~0)
return fn;
25 if (split == ~0)
return "";
32 if (split == ~0)
return "";
35 if (split + 1 < filePath.
length())
return filePath.
subString(0,split+1);
41 string combine(
string basePath,
string fileName) {
42 if (basePath.
length() > 0) {
46 return basePath + fileName;
54 return g_pathSeparators.
indexOf(c) != ~0;
79 const char c = fn[walk];
85 output << replacement.
ptr();
90 return output.toString();
97 const char c = fn[walk];
101 output << replacement.
ptr();
106 return output.toString();
111 string walk = inside;
114 if (walk ==
"")
return false;
115 if (
equals(directory,walk))
return true;
151 return c ==
' ' || c ==
'.';
156 for(
t_size walk = 0; name[walk];) {
157 if (name[walk] ==
'?') {
159 do { ++end; }
while(name[end] ==
'?');
178 if (end < name.
length() || begin > 0) name = name.
subString(begin,end - begin);
180 if (name.
isEmpty()) name =
"_";
static bool isIllegalTrailingChar(char c)
static const string g_illegalNameChars(g_pathSeparators#ifdef _WINDOWS+":<>*?\""#else+"*?"#endif)
string getDirectory(string filePath)
string combine(string basePath, string fileName)
string getFileName(string path)
string subString(t_size base) const
string validateFileName(string name, bool allowWC)
t_size lastIndexOfAnyChar(stringp s, t_size base=~0) const
string getFileNameWithoutExtension(string path)
bool isDirectoryRoot(string path)
static string replaceIllegalChar(char c)
static bool isNonTextChar(char c)
bool containsAnyChar(stringp s) const
string8_fastalloc string_formatter
static const string g_pathSeparators("\\/|")
string getParent(string filePath)
t_size lastIndexOf(char c, t_size base=~0) const
bool isInsideDirectory(pfc::string directory, pfc::string inside)
string getIllegalNameChars(bool allowWC)
string getFileExtension(string path)
string replaceIllegalNameChars(string fn, bool allowWC)
string replaceIllegalPathChars(string fn)
char getDefaultSeparator()
bool contains(char c) const
New EXPERIMENTAL string class, allowing efficient copies and returning from functions. Does not implement the string_base interface so you still need string8 in many cases. Safe to pass between DLLs, but since a reference is used, objects possibly created by other DLLs must be released before owning DLLs are unloaded.
t_size indexOf(char c, t_size base=0) const
static const string g_illegalNameChars_noWC(g_pathSeparators#ifdef _WINDOWS+":<>?\""#endif)
bool equals(const t1 &v1, const t2 &v2)