Home | History | Annotate | Download | only in src

Lines Matching full:filepath

32 #include "gtest/internal/gtest-filepath.h"
100 FilePath FilePath::GetCurrentDir() {
104 return FilePath(kCurrentDirectoryString);
107 return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
110 return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
114 // Returns a copy of the FilePath with the case-insensitive extension removed.
115 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
116 // FilePath("dir/file"). If a case-insensitive extension is not
117 // found, returns a copy of the original FilePath.
118 FilePath FilePath::RemoveExtension(const char* extension) const {
121 return FilePath(String(pathname_.c_str(), pathname_.length() - 4));
127 // the FilePath. On Windows, for example, both '/' and '\' are valid path
129 const char* FilePath::FindLastPathSeparator() const {
142 // Returns a copy of the FilePath with the directory part removed.
143 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
144 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
145 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
146 // returns an empty FilePath ("").
148 FilePath FilePath::RemoveDirectoryName() const {
150 return last_sep ? FilePath(String(last_sep + 1)) : *this;
154 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
155 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
156 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
157 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
159 FilePath FilePath::RemoveFileName() const {
167 return FilePath(dir);
176 FilePath FilePath::MakeFileName(const FilePath& directory,
177 const FilePath& base_name,
186 return ConcatPaths(directory, FilePath(file));
191 FilePath FilePath::ConcatPaths(const FilePath& directory,
192 const FilePath& relative_path) {
195 const FilePath dir(directory.RemoveTrailingPathSeparator());
196 return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
202 bool FilePath::FileOrDirectoryExists() const {
216 bool FilePath::DirectoryExists() const {
221 const FilePath& path(IsRootDirectory() ? *this :
224 const FilePath& path(*this);
246 bool FilePath::IsRootDirectory() const {
258 bool FilePath::IsAbsolutePath() const {
279 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
280 const FilePath& base_name,
282 FilePath full_pathname;
290 // Returns true if FilePath ends with a path separator, which indicates that
293 bool FilePath::IsDirectory() const {
301 bool FilePath::CreateDirectoriesRecursively() const {
310 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
318 bool FilePath::CreateFolder() const {
320 FilePath removed_sep(this->RemoveTrailingPathSeparator());
339 FilePath FilePath::RemoveTrailingPathSeparator() const {
341 ? FilePath(String(pathname_.c_str(), pathname_.length() - 1))
349 void FilePath::Normalize() {