• Home
  • Raw
  • Download

Lines Matching full:filepath

33 #include "gtest/internal/gtest-filepath.h"
99 FilePath FilePath::GetCurrentDir() { in GetCurrentDir()
103 return FilePath(kCurrentDirectoryString); in GetCurrentDir()
106 return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd); in GetCurrentDir()
114 return FilePath(result == NULL ? kCurrentDirectoryString : cwd); in GetCurrentDir()
116 return FilePath(result == NULL ? "" : cwd); in GetCurrentDir()
120 // Returns a copy of the FilePath with the case-insensitive extension removed.
121 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
122 // FilePath("dir/file"). If a case-insensitive extension is not
123 // found, returns a copy of the original FilePath.
124 FilePath FilePath::RemoveExtension(const char* extension) const { in RemoveExtension()
127 return FilePath(pathname_.substr( in RemoveExtension()
134 // the FilePath. On Windows, for example, both '/' and '\' are valid path
136 const char* FilePath::FindLastPathSeparator() const { in FindLastPathSeparator()
149 // Returns a copy of the FilePath with the directory part removed.
150 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
151 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
152 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
153 // returns an empty FilePath ("").
155 FilePath FilePath::RemoveDirectoryName() const { in RemoveDirectoryName()
157 return last_sep ? FilePath(last_sep + 1) : *this; in RemoveDirectoryName()
161 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
162 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
163 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
164 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
166 FilePath FilePath::RemoveFileName() const { in RemoveFileName()
174 return FilePath(dir); in RemoveFileName()
183 FilePath FilePath::MakeFileName(const FilePath& directory, in MakeFileName()
184 const FilePath& base_name, in MakeFileName()
194 return ConcatPaths(directory, FilePath(file)); in MakeFileName()
199 FilePath FilePath::ConcatPaths(const FilePath& directory, in ConcatPaths()
200 const FilePath& relative_path) { in ConcatPaths()
203 const FilePath dir(directory.RemoveTrailingPathSeparator()); in ConcatPaths()
204 return FilePath(dir.string() + kPathSeparator + relative_path.string()); in ConcatPaths()
209 bool FilePath::FileOrDirectoryExists() const { in FileOrDirectoryExists()
223 bool FilePath::DirectoryExists() const { in DirectoryExists()
228 const FilePath& path(IsRootDirectory() ? *this : in DirectoryExists()
231 const FilePath& path(*this); in DirectoryExists()
253 bool FilePath::IsRootDirectory() const { in IsRootDirectory()
265 bool FilePath::IsAbsolutePath() const { in IsAbsolutePath()
286 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory, in GenerateUniqueFileName()
287 const FilePath& base_name, in GenerateUniqueFileName()
289 FilePath full_pathname; in GenerateUniqueFileName()
297 // Returns true if FilePath ends with a path separator, which indicates that
300 bool FilePath::IsDirectory() const { in IsDirectory()
308 bool FilePath::CreateDirectoriesRecursively() const { in CreateDirectoriesRecursively()
317 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName()); in CreateDirectoriesRecursively()
325 bool FilePath::CreateFolder() const { in CreateFolder()
327 FilePath removed_sep(this->RemoveTrailingPathSeparator()); in CreateFolder()
346 FilePath FilePath::RemoveTrailingPathSeparator() const { in RemoveTrailingPathSeparator()
348 ? FilePath(pathname_.substr(0, pathname_.length() - 1)) in RemoveTrailingPathSeparator()
356 void FilePath::Normalize() { in Normalize()