Lines Matching full:filepath
33 #include "gtest/internal/gtest-filepath.h"
101 FilePath FilePath::GetCurrentDir() {
105 return FilePath(kCurrentDirectoryString);
108 return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
111 return FilePath(getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
115 // Returns a copy of the FilePath with the case-insensitive extension removed.
116 // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
117 // FilePath("dir/file"). If a case-insensitive extension is not
118 // found, returns a copy of the original FilePath.
119 FilePath FilePath::RemoveExtension(const char* extension) const {
122 return FilePath(pathname_.substr(
129 // the FilePath. On Windows, for example, both '/' and '\' are valid path
131 const char* FilePath::FindLastPathSeparator() const {
144 // Returns a copy of the FilePath with the directory part removed.
145 // Example: FilePath("path/to/file").RemoveDirectoryName() returns
146 // FilePath("file"). If there is no directory part ("just_a_file"), it returns
147 // the FilePath unmodified. If there is no file part ("just_a_dir/") it
148 // returns an empty FilePath ("").
150 FilePath FilePath::RemoveDirectoryName() const {
152 return last_sep ? FilePath(last_sep + 1) : *this;
156 // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
157 // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
158 // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
159 // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
161 FilePath FilePath::RemoveFileName() const {
169 return FilePath(dir);
178 FilePath FilePath::MakeFileName(const FilePath& directory,
179 const FilePath& base_name,
189 return ConcatPaths(directory, FilePath(file));
194 FilePath FilePath::ConcatPaths(const FilePath& directory,
195 const FilePath& relative_path) {
198 const FilePath dir(directory.RemoveTrailingPathSeparator());
199 return FilePath(dir.string() + kPathSeparator + relative_path.string());
204 bool FilePath::FileOrDirectoryExists() const {
218 bool FilePath::DirectoryExists() const {
223 const FilePath& path(IsRootDirectory() ? *this :
226 const FilePath& path(*this);
248 bool FilePath::IsRootDirectory() const {
260 bool FilePath::IsAbsolutePath() const {
281 FilePath FilePath::GenerateUniqueFileName(const FilePath& directory,
282 const FilePath& base_name,
284 FilePath full_pathname;
292 // Returns true if FilePath ends with a path separator, which indicates that
295 bool FilePath::IsDirectory() const {
303 bool FilePath::CreateDirectoriesRecursively() const {
312 const FilePath parent(this->RemoveTrailingPathSeparator().RemoveFileName());
320 bool FilePath::CreateFolder() const {
322 FilePath removed_sep(this->RemoveTrailingPathSeparator());
341 FilePath FilePath::RemoveTrailingPathSeparator() const {
343 ? FilePath(pathname_.substr(0, pathname_.length() - 1))
351 void FilePath::Normalize() {