Home | History | Annotate | Download | only in src

Lines Matching refs:filepath

32 #include <gtest/internal/gtest-filepath.h>
89 FilePath FilePath::GetCurrentDir() {
93 return FilePath(kCurrentDirectoryString);
96 return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
99 return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
103 // Returns a copy of the FilePath with the case-insensitive extension removed.
104 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
105 // FilePath("dir/file"). If a case-insensitive extension is not
106 // found, returns a copy of the original FilePath.
107 FilePath FilePath::RemoveExtension(const char* extension) const {
110 return FilePath(String(pathname_.c_str(), pathname_.GetLength() - 4));
115 // Returns a copy of the FilePath with the directory part removed.
116 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
117 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
118 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
119 // returns an empty FilePath ("").
121 FilePath FilePath::RemoveDirectoryName() const {
123 return last_sep ? FilePath(String(last_sep + 1)) : *this;
127 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
128 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
129 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
130 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
132 FilePath FilePath::RemoveFileName() const {
134 return FilePath(last_sep ? String(c_str(), last_sep + 1 - c_str())
144 FilePath FilePath::MakeFileName(const FilePath& directory,
145 const FilePath& base_name,
148 const FilePath file_name(
157 FilePath FilePath::ConcatPaths(const FilePath& directory,
158 const FilePath& relative_path) {
161 const FilePath dir(directory.RemoveTrailingPathSeparator());
162 return FilePath(String::Format("%s%c%s", dir.c_str(), kPathSeparator,
168 bool FilePath::FileOrDirectoryExists() const {
187 bool FilePath::DirectoryExists() const {
192 const FilePath& path(IsRootDirectory() ? *this :
217 bool FilePath::IsRootDirectory() const {
229 bool FilePath::IsAbsolutePath() const {
250 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
251 const FilePath& base_name,
253 FilePath full_pathname;
261 // Returns true if FilePath ends with a path separator, which indicates that
264 bool FilePath::IsDirectory() const {
271 bool FilePath::CreateDirectoriesRecursively() const {
280 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
288 bool FilePath::CreateFolder() const {
291 FilePath removed_sep(this->RemoveTrailingPathSeparator());
310 FilePath FilePath::RemoveTrailingPathSeparator() const {
312 ? FilePath(String(pathname_.c_str(), pathname_.GetLength() - 1))
319 void FilePath::Normalize() {