Home | History | Annotate | Download | only in src

Lines Matching refs:FilePath

32 #include "gtest/internal/gtest-filepath.h"
98 FilePath FilePath::GetCurrentDir() {
102 return FilePath(kCurrentDirectoryString);
105 return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
108 return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
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 {
119 return FilePath(String(pathname_.c_str(), pathname_.length() - 4));
125 // the FilePath. On Windows, for example, both '/' and '\' are valid path
127 const char* FilePath::FindLastPathSeparator() const {
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 {
148 return last_sep ? FilePath(String(last_sep + 1)) : *this;
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 {
165 return FilePath(dir);
174 FilePath FilePath::MakeFileName(const FilePath& directory,
175 const FilePath& base_name,
184 return ConcatPaths(directory, FilePath(file));
189 FilePath FilePath::ConcatPaths(const FilePath& directory,
190 const FilePath& relative_path) {
193 const FilePath dir(directory.RemoveTrailingPathSeparator());
194 return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
200 bool FilePath::FileOrDirectoryExists() const {
214 bool FilePath::DirectoryExists() const {
219 const FilePath& path(IsRootDirectory() ? *this :
222 const FilePath& path(*this);
244 bool FilePath::IsRootDirectory() const {
256 bool FilePath::IsAbsolutePath() const {
277 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
278 const FilePath& base_name,
280 FilePath full_pathname;
288 // Returns true if FilePath ends with a path separator, which indicates that
291 bool FilePath::IsDirectory() const {
299 bool FilePath::CreateDirectoriesRecursively() const {
308 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
316 bool FilePath::CreateFolder() const {
318 FilePath removed_sep(this->RemoveTrailingPathSeparator());
337 FilePath FilePath::RemoveTrailingPathSeparator() const {
339 ? FilePath(String(pathname_.c_str(), pathname_.length() - 1))
347 void FilePath::Normalize() {