bool makeAllDirectories(const String& path) { CString fullPath = fileSystemRepresentation(path); if (!access(fullPath.data(), F_OK)) return true; char* p = fullPath.mutableData() + 1; int length = fullPath.length(); if(p[length - 1] == '/') p[length - 1] = '\0'; for (; *p; ++p) if (*p == '/') { *p = '\0'; if (access(fullPath.data(), F_OK)) if (mkdir(fullPath.data(), S_IRWXU)) return false; *p = '/'; } if (access(fullPath.data(), F_OK)) if (mkdir(fullPath.data(), S_IRWXU)) return false; return true; }
String directoryName(const String& path) { CString fsRep = fileSystemRepresentation(path); if (!fsRep.data() || fsRep.data()[0] == '\0') return String(); return dirname(fsRep.mutableData()); }
static CString toUpper(const CString& lower) { CString upper = lower; for (char* buffer = upper.mutableData(); *buffer; ++buffer) *buffer = toASCIIUpper(*buffer); return upper; }