Lines Matching refs:Path
1 //===-- Path.cpp - Implement OS Path Concept ------------------------------===//
9 // This file implements the operating system Path API.
13 #include "llvm/Support/Path.h"
229 i.Path = path;
238 i.Path = path;
244 assert(Position < Path.size() && "Tried to increment past end!");
250 if (Position == Path.size()) {
261 if (is_separator(Path[Position], S)) {
266 Component = Path.substr(Position, 1);
271 while (Position != Path.size() && is_separator(Path[Position], S)) {
276 if (Position == Path.size() && Component != "/") {
284 size_t end_pos = Path.find_first_of(separators(S), Position);
285 Component = Path.slice(Position, end_pos);
291 return Path.begin() == RHS.Path.begin() && Position == RHS.Position;
298 reverse_iterator rbegin(StringRef Path, Style style) {
300 I.Path = Path;
301 I.Position = Path.size();
307 reverse_iterator rend(StringRef Path) {
309 I.Path = Path;
310 I.Component = Path.substr(0, 0);
316 size_t root_dir_pos = root_dir_start(Path, S);
321 is_separator(Path[end_pos - 1], S))
325 if (Position == Path.size() && !Path.empty() &&
326 is_separator(Path.back(), S) &&
334 size_t start_pos = filename_pos(Path.substr(0, end_pos), S);
335 Component = Path.slice(start_pos, end_pos);
341 return Path.begin() == RHS.Path.begin() && Component == RHS.Component &&
500 static bool starts_with(StringRef Path, StringRef Prefix,
504 if (Path.size() < Prefix.size())
507 bool SepPath = is_separator(Path[I], style);
511 if (!SepPath && toLower(Path[I]) != toLower(Prefix[I]))
516 return Path.starts_with(Prefix);
519 bool replace_path_prefix(SmallVectorImpl<char> &Path, StringRef OldPrefix,
524 StringRef OrigPath(Path.begin(), Path.size());
530 llvm::copy(NewPrefix, Path.begin());
537 Path.swap(NewPath);
551 void native(SmallVectorImpl<char> &Path, Style style) {
552 if (Path.empty())
555 for (char &Ch : Path)
558 if (Path[0] == '~' && (Path.size() == 1 || is_separator(Path[1], style))) {
561 PathHome.append(Path.begin() + 1, Path.end());
562 Path = PathHome;
565 std::replace(Path.begin(), Path.end(), '\\', '/');
704 StringRef remove_leading_dotslash(StringRef Path, Style style) {
706 while (Path.size() > 2 && Path[0] == '.' && is_separator(Path[1], style)) {
707 Path = Path.substr(2);
708 while (Path.size() > 0 && is_separator(Path[0], style))
709 Path = Path.substr(1);
711 return Path;
788 std::error_code getUniqueID(const Twine Path, UniqueID &Result) {
790 std::error_code EC = status(Path, Status);
968 std::error_code create_directories(const Twine &Path, bool IgnoreExisting,
971 StringRef P = Path.toStringRef(PathStorage);
1068 ErrorOr<MD5::MD5Result> md5_contents(const Twine &Path) {
1070 if (auto EC = openFileForRead(Path, FD, OF_None))
1086 file_type get_file_type(const Twine &Path, bool Follow) {
1088 if (status(Path, st, Follow))
1135 std::error_code is_other(const Twine &Path, bool &Result) {
1137 if (std::error_code EC = status(Path, FileStatus))
1145 SmallString<128> PathStr = path::parent_path(Path);
1147 this->Path = std::string(PathStr);
1152 ErrorOr<perms> getPermissions(const Twine &Path) {
1154 if (std::error_code EC = status(Path, Status))
1200 #include "Unix/Path.inc"
1203 #include "Windows/Path.inc"