• Home
  • Raw
  • Download

Lines Matching full:filepath

32 #include "gtest/internal/gtest-filepath.h"
98 FilePath FilePath::GetCurrentDir() { in GetCurrentDir()
102 return FilePath(kCurrentDirectoryString); in GetCurrentDir()
105 return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd); in GetCurrentDir()
108 return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd); in GetCurrentDir()
112 // Returns a copy of the FilePath with the case-insensitive extension removed.
113 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
114 // FilePath("dir/file"). If a case-insensitive extension is not
115 // found, returns a copy of the original FilePath.
116 FilePath FilePath::RemoveExtension(const char* extension) const { in RemoveExtension()
119 return FilePath(String(pathname_.c_str(), pathname_.length() - 4)); in RemoveExtension()
125 // the FilePath. On Windows, for example, both '/' and '\' are valid path
127 const char* FilePath::FindLastPathSeparator() const { in FindLastPathSeparator()
140 // Returns a copy of the FilePath with the directory part removed.
141 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
142 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
143 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
144 // returns an empty FilePath ("").
146 FilePath FilePath::RemoveDirectoryName() const { in RemoveDirectoryName()
148 return last_sep ? FilePath(String(last_sep + 1)) : *this; in RemoveDirectoryName()
152 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
153 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
154 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
155 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
157 FilePath FilePath::RemoveFileName() const { in RemoveFileName()
165 return FilePath(dir); in RemoveFileName()
174 FilePath FilePath::MakeFileName(const FilePath& directory, in MakeFileName()
175 const FilePath& base_name, in MakeFileName()
184 return ConcatPaths(directory, FilePath(file)); in MakeFileName()
189 FilePath FilePath::ConcatPaths(const FilePath& directory, in ConcatPaths()
190 const FilePath& relative_path) { in ConcatPaths()
193 const FilePath dir(directory.RemoveTrailingPathSeparator()); in ConcatPaths()
194 return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator, in ConcatPaths()
200 bool FilePath::FileOrDirectoryExists() const { in FileOrDirectoryExists()
214 bool FilePath::DirectoryExists() const { in DirectoryExists()
219 const FilePath& path(IsRootDirectory() ? *this : in DirectoryExists()
222 const FilePath& path(*this); in DirectoryExists()
244 bool FilePath::IsRootDirectory() const { in IsRootDirectory()
256 bool FilePath::IsAbsolutePath() const { in IsAbsolutePath()
277 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory, in GenerateUniqueFileName()
278 const FilePath& base_name, in GenerateUniqueFileName()
280 FilePath full_pathname; in GenerateUniqueFileName()
288 // Returns true if FilePath ends with a path separator, which indicates that
291 bool FilePath::IsDirectory() const { in IsDirectory()
299 bool FilePath::CreateDirectoriesRecursively() const { in CreateDirectoriesRecursively()
308 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName()); in CreateDirectoriesRecursively()
316 bool FilePath::CreateFolder() const { in CreateFolder()
318 FilePath removed_sep(this->RemoveTrailingPathSeparator()); in CreateFolder()
337 FilePath FilePath::RemoveTrailingPathSeparator() const { in RemoveTrailingPathSeparator()
339 ? FilePath(String(pathname_.c_str(), pathname_.length() - 1)) in RemoveTrailingPathSeparator()
347 void FilePath::Normalize() { in Normalize()