class FilePath

Defined at line 70 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

FilePath - a class for file and directory pathname manipulation which

handles platform-specific conventions (like the pathname separator).

Used for helper functions for naming files in a directory for xml output.

Except for Set methods, all methods are const or static, which provides an

"immutable value object" -- useful for peace of mind.

A FilePath with a value ending in a path separator ("like/this/") represents

a directory, otherwise it is assumed to represent a file. In either case,

it may or may not represent an actual file or directory in the file system.

Names are NOT checked for syntax correctness -- no checking for illegal

characters, malformed paths, etc.

Public Methods

void FilePath ()

Defined at line 72 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

void FilePath (const FilePath & rhs)

Defined at line 73 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

void FilePath (FilePath && rhs)

Defined at line 74 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

void FilePath (std::string pathname)

Defined at line 76 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

FilePath GetCurrentDir ()

Returns the current working directory, or "" if unsuccessful.

FilePath MakeFileName (const FilePath & directory, const FilePath & base_name, int number, const char * extension)

Given directory = "dir", base_name = "test", number = 0,

extension = "xml", returns "dir/test.xml". If number is greater

than zero (e.g., 12), returns "dir/test_12.xml".

On Windows platform, uses

\

as the separator rather than /.

FilePath ConcatPaths (const FilePath & directory, const FilePath & relative_path)

Given directory = "dir", relative_path = "test.xml",

returns "dir/test.xml".

On Windows, uses

\

as the separator rather than /.

FilePath GenerateUniqueFileName (const FilePath & directory, const FilePath & base_name, const char * extension)

Returns a pathname for a file that does not currently exist. The pathname

will be directory/base_name.extension or

directory/base_name_

<number

>.extension if directory/base_name.extension

already exists. The number will be incremented until a pathname is found

that does not already exist.

Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.

There could be a race condition if two or more processes are calling this

function at the same time -- they could both pick the same filename.

FilePath & operator= (const FilePath & rhs)

Defined at line 80 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

FilePath & operator= (FilePath && rhs)

Defined at line 84 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

void Set (const FilePath & rhs)

Defined at line 89 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

const std::string & string ()

Defined at line 91 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

const char * c_str ()

Defined at line 92 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

bool IsEmpty ()

Returns true if and only if the path is "".

Defined at line 124 of file ../../third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h

FilePath RemoveTrailingPathSeparator ()

If input name has a trailing separator character, removes it and returns

the name, otherwise return the name string unmodified.

On Windows platform, uses

\

as the separator, other platforms use /.

FilePath RemoveDirectoryName ()

Returns a copy of the FilePath with the directory part removed.

Example: FilePath("path/to/file").RemoveDirectoryName() returns

FilePath("file"). If there is no directory part ("just_a_file"), it returns

the FilePath unmodified. If there is no file part ("just_a_dir/") it

returns an empty FilePath ("").

On Windows platform, '

\

' is the path separator, otherwise it is '/'.

FilePath RemoveFileName ()

RemoveFileName returns the directory path with the filename removed.

Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".

If the FilePath is "a_file" or "/a_file", RemoveFileName returns

FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does

not have a file, like "just/a/dir/", it returns the FilePath unmodified.

On Windows platform, '

\

' is the path separator, otherwise it is '/'.

FilePath RemoveExtension (const char * extension)

Returns a copy of the FilePath with the case-insensitive extension removed.

Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns

FilePath("dir/file"). If a case-insensitive extension is not

found, returns a copy of the original FilePath.

bool CreateDirectoriesRecursively ()

Creates directories so that path exists. Returns true if successful or if

the directories already exist; returns false if unable to create

directories for any reason. Will also return false if the FilePath does

not represent a directory (that is, it doesn't end with a path separator).

bool CreateFolder ()

Create the directory so that path exists. Returns true if successful or

if the directory already exists; returns false if unable to create the

directory for any reason, including if the parent directory does not

exist. Not named "CreateDirectory" because that's a macro on Windows.

bool FileOrDirectoryExists ()

Returns true if FilePath describes something in the file-system,

either a file, directory, or whatever, and that something exists.

bool DirectoryExists ()

Returns true if pathname describes a directory in the file-system

that exists.

bool IsDirectory ()

Returns true if FilePath ends with a path separator, which indicates that

it is intended to represent a directory. Returns false otherwise.

This does NOT check that a directory (or file) actually exists.

bool IsRootDirectory ()

Returns true if pathname describes a root directory. (Windows has one

root directory per disk drive.)

bool IsAbsolutePath ()

Returns true if pathname describes an absolute path.