Home | History | Annotate | Download | only in src

Lines Matching refs:FilePath

32 #include <gtest/internal/gtest-filepath.h>
85 FilePath FilePath::GetCurrentDir() {
89 return FilePath(kCurrentDirectoryString);
92 return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
95 return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
99 // Returns a copy of the FilePath with the case-insensitive extension removed.
100 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
101 // FilePath("dir/file"). If a case-insensitive extension is not
102 // found, returns a copy of the original FilePath.
103 FilePath FilePath::RemoveExtension(const char* extension) const {
106 return FilePath(String(pathname_.c_str(), pathname_.length() - 4));
111 // Returns a copy of the FilePath with the directory part removed.
112 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
113 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
114 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
115 // returns an empty FilePath ("").
117 FilePath FilePath::RemoveDirectoryName() const {
119 return last_sep ? FilePath(String(last_sep + 1)) : *this;
123 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
124 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
125 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
126 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
128 FilePath FilePath::RemoveFileName() const {
136 return FilePath(dir);
145 FilePath FilePath::MakeFileName(const FilePath& directory,
146 const FilePath& base_name,
155 return ConcatPaths(directory, FilePath(file));
160 FilePath FilePath::ConcatPaths(const FilePath& directory,
161 const FilePath& relative_path) {
164 const FilePath dir(directory.RemoveTrailingPathSeparator());
165 return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
171 bool FilePath::FileOrDirectoryExists() const {
185 bool FilePath::DirectoryExists() const {
190 const FilePath& path(IsRootDirectory() ? *this :
193 const FilePath& path(*this);
215 bool FilePath::IsRootDirectory() const {
227 bool FilePath::IsAbsolutePath() const {
248 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
249 const FilePath& base_name,
251 FilePath full_pathname;
259 // Returns true if FilePath ends with a path separator, which indicates that
262 bool FilePath::IsDirectory() const {
269 bool FilePath::CreateDirectoriesRecursively() const {
278 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
286 bool FilePath::CreateFolder() const {
288 FilePath removed_sep(this->RemoveTrailingPathSeparator());
307 FilePath FilePath::RemoveTrailingPathSeparator() const {
309 ? FilePath(String(pathname_.c_str(), pathname_.length() - 1))
316 void FilePath::Normalize() {