Lines Matching refs:path

60 size_t PathUtils::rootPrefixSize(const std::string& path, HostType hostType) {  in rootPrefixSize()  argument
61 if (path.empty()) return 0; in rootPrefixSize()
64 return (path[0] == '/') ? 1U : 0U; in rootPrefixSize()
67 if (path[1] == ':') { in rootPrefixSize()
68 int ch = path[0]; in rootPrefixSize()
71 } else if (!strncmp(path.c_str(), "\\\\.\\", 4) || in rootPrefixSize()
72 !strncmp(path.c_str(), "\\\\?\\", 4)) { in rootPrefixSize()
75 } else if (isDirSeparator(path[0], hostType)) { in rootPrefixSize()
77 if (isDirSeparator(path[1], hostType)) { in rootPrefixSize()
79 while (path[result] && !isDirSeparator(path[result], HOST_WIN32)) in rootPrefixSize()
83 if (result && path[result] && isDirSeparator(path[result], HOST_WIN32)) in rootPrefixSize()
90 bool PathUtils::isAbsolute(const char* path, HostType hostType) { in isAbsolute() argument
91 size_t prefixSize = rootPrefixSize(path, hostType); in isAbsolute()
98 return isDirSeparator(path[prefixSize - 1], HOST_WIN32); in isAbsolute()
102 std::string_view PathUtils::extension(const std::string& path, in extension() argument
104 std::string_view tmp = path; in extension()
125 std::string PathUtils::removeTrailingDirSeparator(const char* path, in removeTrailingDirSeparator() argument
127 size_t pathLen = strlen(path); in removeTrailingDirSeparator()
129 while (pathLen > 1U && isDirSeparator(path[pathLen - 1U], hostType)) { in removeTrailingDirSeparator()
132 return std::string(path, pathLen); in removeTrailingDirSeparator()
136 std::string PathUtils::addTrailingDirSeparator(const char* path, in addTrailingDirSeparator() argument
138 std::string result = path; in addTrailingDirSeparator()
146 bool PathUtils::split(const char* path, in split() argument
150 if (sIsEmpty(path)) { in split()
155 size_t end = strlen(path); in split()
156 if (isDirSeparator(path[end - 1U], hostType)) { in split()
161 size_t prefixLen = rootPrefixSize(path, hostType); in split()
163 while (pos > prefixLen && !isDirSeparator(path[pos - 1U], hostType)) { in split()
170 *dirName = std::string(path, pos); in split()
173 *baseName = path + pos; in split()
183 *dirName = std::string(path, prefixLen); in split()
187 *baseName = path + prefixLen; in split()
216 static std::vector<String> decomposeImpl(const String& path, PathUtils::HostType hostType) { in decomposeImpl() argument
218 if (path.empty()) in decomposeImpl()
221 size_t prefixLen = PathUtils::rootPrefixSize(path, hostType); in decomposeImpl()
222 auto it = path.begin(); in decomposeImpl()
229 while (p != path.end() && !PathUtils::isDirSeparator(*p, hostType)) in decomposeImpl()
234 if (p == path.end()) { in decomposeImpl()
242 std::vector<std::string> PathUtils::decompose(std::string&& path, in decompose() argument
244 return decomposeImpl<std::string>(path, hostType); in decompose()
247 std::vector<std::string> PathUtils::decompose(const std::string& path, in decompose() argument
249 return decomposeImpl<std::string>(path, hostType); in decompose()
329 const std::string& path, in relativeTo() argument
332 auto pathDecomposed = decompose(path, hostType); in relativeTo()
335 return path; in relativeTo()
339 return path; in relativeTo()
372 Win32UnicodeString win32Path(const char* path) { in win32Path() argument
373 Win32UnicodeString wpath(path); in win32Path()
408 bool pathExists(const char* path) { in pathExists() argument
410 return _waccess(win32Path(path).c_str(), GetWin32Mode(F_OK)); in pathExists()
412 return 0 == access(path, F_OK); in pathExists()
438 std::string PathUtils::addTrailingDirSeparator(const std::string& path, in addTrailingDirSeparator() argument
440 std::string result = path; in addTrailingDirSeparator()