Lines Matching full:filepath
32 #include <gtest/internal/gtest-filepath.h>
57 // Returns a copy of the FilePath with the case-insensitive extension removed.
58 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
59 // FilePath("dir/file"). If a case-insensitive extension is not
60 // found, returns a copy of the original FilePath.
61 FilePath FilePath::RemoveExtension(const char* extension) const {
64 return FilePath(String(pathname_.c_str(), pathname_.GetLength() - 4));
69 // Returns a copy of the FilePath with the directory part removed.
70 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
71 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
72 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
73 // returns an empty FilePath ("").
75 FilePath FilePath::RemoveDirectoryName() const {
77 return last_sep ? FilePath(String(last_sep + 1)) : *this;
81 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
82 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
83 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
84 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
86 FilePath FilePath::RemoveFileName() const {
88 return FilePath(last_sep ? String(c_str(), last_sep + 1 - c_str())
98 FilePath FilePath::MakeFileName(const FilePath& directory,
99 const FilePath& base_name,
102 FilePath dir(directory.RemoveTrailingPathSeparator());
104 return FilePath(String::Format("%s%c%s.%s", dir.c_str(), kPathSeparator,
107 return FilePath(String::Format("%s%c%s_%d.%s", dir.c_str(), kPathSeparator,
113 bool FilePath::FileOrDirectoryExists() const {
125 bool FilePath::DirectoryExists() const {
128 FilePath removed_sep(this->RemoveTrailingPathSeparator());
150 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
151 const FilePath& base_name,
153 FilePath full_pathname;
161 // Returns true if FilePath ends with a path separator, which indicates that
164 bool FilePath::IsDirectory() const {
171 bool FilePath::CreateDirectoriesRecursively() const {
180 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
188 bool FilePath::CreateFolder() const {
203 FilePath FilePath::RemoveTrailingPathSeparator() const {
205 ? FilePath(String(pathname_.c_str(), pathname_.GetLength() - 1))