#include <gtest-filepath.h>
Definition at line 58 of file gtest-filepath.h.
◆ FilePath() [1/3]
testing::internal::FilePath::FilePath |
( |
| ) |
|
|
inline |
◆ FilePath() [2/3]
testing::internal::FilePath::FilePath |
( |
const FilePath & | rhs | ) |
|
|
inline |
◆ FilePath() [3/3]
testing::internal::FilePath::FilePath |
( |
const std::string & | pathname | ) |
|
|
inlineexplicit |
Definition at line 63 of file gtest-filepath.h.
63 : pathname_(pathname) {
64 Normalize();
65 }
◆ c_str()
const char * testing::internal::FilePath::c_str |
( |
| ) |
const |
|
inline |
◆ ConcatPaths()
Definition at line 197 of file gtest-filepath.cc.
198 {
199 if (directory.IsEmpty())
200 return relative_path;
201 const FilePath dir(directory.RemoveTrailingPathSeparator());
203}
const char kPathSeparator
◆ CreateDirectoriesRecursively()
bool testing::internal::FilePath::CreateDirectoriesRecursively |
( |
| ) |
const |
Definition at line 306 of file gtest-filepath.cc.
306 {
308 return false;
309 }
310
311 if (pathname_.length() == 0 || this->DirectoryExists()) {
312 return true;
313 }
314
316 return parent.CreateDirectoriesRecursively() && this->
CreateFolder();
317}
FilePath RemoveFileName() const
FilePath RemoveTrailingPathSeparator() const
bool CreateFolder() const
◆ CreateFolder()
bool testing::internal::FilePath::CreateFolder |
( |
| ) |
const |
Definition at line 323 of file gtest-filepath.cc.
323 {
324#if GTEST_OS_WINDOWS_MOBILE
326 LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
327 int result = CreateDirectory(unicode, NULL) ? 0 : -1;
328 delete [] unicode;
329#elif GTEST_OS_WINDOWS
330 int result = _mkdir(pathname_.c_str());
331#else
332 int result = mkdir(pathname_.c_str(), 0777);
333#endif
334
335 if (result == -1) {
337 }
338 return true;
339}
bool DirectoryExists() const
◆ DirectoryExists()
bool testing::internal::FilePath::DirectoryExists |
( |
| ) |
const |
Definition at line 221 of file gtest-filepath.cc.
221 {
222 bool result = false;
223#if GTEST_OS_WINDOWS
224
225
228#else
230#endif
231
232#if GTEST_OS_WINDOWS_MOBILE
233 LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
234 const DWORD attributes = GetFileAttributes(unicode);
235 delete [] unicode;
236 if ((attributes != kInvalidFileAttributes) &&
237 (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
238 result = true;
239 }
240#else
242 result =
posix::Stat(path.c_str(), &file_stat) == 0 &&
244#endif
245
246 return result;
247}
bool IsRootDirectory() const
int Stat(const char *path, StatStruct *buf)
bool IsDir(const StatStruct &st)
◆ FileOrDirectoryExists()
bool testing::internal::FilePath::FileOrDirectoryExists |
( |
| ) |
const |
Definition at line 207 of file gtest-filepath.cc.
207 {
208#if GTEST_OS_WINDOWS_MOBILE
209 LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
210 const DWORD attributes = GetFileAttributes(unicode);
211 delete [] unicode;
212 return attributes != kInvalidFileAttributes;
213#else
215 return posix::Stat(pathname_.c_str(), &file_stat) == 0;
216#endif
217}
◆ GenerateUniqueFileName()
FilePath testing::internal::FilePath::GenerateUniqueFileName |
( |
const FilePath & | directory, |
|
|
const FilePath & | base_name, |
|
|
const char * | extension ) |
|
static |
Definition at line 284 of file gtest-filepath.cc.
286 {
288 int number = 0;
289 do {
290 full_pathname.Set(
MakeFileName(directory, base_name, number++, extension));
291 } while (full_pathname.FileOrDirectoryExists());
292 return full_pathname;
293}
static FilePath MakeFileName(const FilePath &directory, const FilePath &base_name, int number, const char *extension)
◆ GetCurrentDir()
FilePath testing::internal::FilePath::GetCurrentDir |
( |
| ) |
|
|
static |
Definition at line 97 of file gtest-filepath.cc.
97 {
98#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT
99
100
102#elif GTEST_OS_WINDOWS
105#else
107 char* result = getcwd(
cwd,
sizeof(
cwd));
108# if GTEST_OS_NACL
109
110
111
113# endif
115#endif
116}
const char kCurrentDirectoryString[]
◆ IsAbsolutePath()
bool testing::internal::FilePath::IsAbsolutePath |
( |
| ) |
const |
Definition at line 263 of file gtest-filepath.cc.
263 {
264 const char*
const name = pathname_.c_str();
265#if GTEST_OS_WINDOWS
266 return pathname_.length() >= 3 &&
267 ((
name[0] >=
'a' &&
name[0] <=
'z') ||
268 (
name[0] >=
'A' &&
name[0] <=
'Z')) &&
270 IsPathSeparator(
name[2]);
271#else
272 return IsPathSeparator(
name[0]);
273#endif
274}
◆ IsDirectory()
bool testing::internal::FilePath::IsDirectory |
( |
| ) |
const |
Definition at line 298 of file gtest-filepath.cc.
298 {
299 return !pathname_.empty() &&
300 IsPathSeparator(pathname_.c_str()[pathname_.length() - 1]);
301}
◆ IsEmpty()
bool testing::internal::FilePath::IsEmpty |
( |
| ) |
const |
|
inline |
◆ IsRootDirectory()
bool testing::internal::FilePath::IsRootDirectory |
( |
| ) |
const |
Definition at line 251 of file gtest-filepath.cc.
251 {
252#if GTEST_OS_WINDOWS
253
254
255
257#else
258 return pathname_.length() == 1 && IsPathSeparator(pathname_.c_str()[0]);
259#endif
260}
bool IsAbsolutePath() const
◆ MakeFileName()
FilePath testing::internal::FilePath::MakeFileName |
( |
const FilePath & | directory, |
|
|
const FilePath & | base_name, |
|
|
int | number, |
|
|
const char * | extension ) |
|
static |
Definition at line 181 of file gtest-filepath.cc.
184 {
185 std::string file;
186 if (number == 0) {
187 file = base_name.string() + "." + extension;
188 } else {
190 + "." + extension;
191 }
193}
static FilePath ConcatPaths(const FilePath &directory, const FilePath &relative_path)
std::string StreamableToString(const T &streamable)
◆ operator=()
Definition at line 67 of file gtest-filepath.h.
67 {
69 return *this;
70 }
void Set(const FilePath &rhs)
◆ RemoveDirectoryName()
FilePath testing::internal::FilePath::RemoveDirectoryName |
( |
| ) |
const |
Definition at line 153 of file gtest-filepath.cc.
153 {
154 const char* const last_sep = FindLastPathSeparator();
155 return last_sep ?
FilePath(last_sep + 1) : *this;
156}
◆ RemoveExtension()
FilePath testing::internal::FilePath::RemoveExtension |
( |
const char * | extension | ) |
const |
Definition at line 122 of file gtest-filepath.cc.
122 {
123 const std::string dot_extension = std::string(".") + extension;
126 0, pathname_.length() - dot_extension.length()));
127 }
128 return *this;
129}
static bool EndsWithCaseInsensitive(const std::string &str, const std::string &suffix)
◆ RemoveFileName()
FilePath testing::internal::FilePath::RemoveFileName |
( |
| ) |
const |
Definition at line 164 of file gtest-filepath.cc.
164 {
165 const char* const last_sep = FindLastPathSeparator();
166 std::string dir;
167 if (last_sep) {
168 dir = std::string(
c_str(), last_sep + 1 -
c_str());
169 } else {
171 }
173}
const char * c_str() const
◆ RemoveTrailingPathSeparator()
FilePath testing::internal::FilePath::RemoveTrailingPathSeparator |
( |
| ) |
const |
◆ Set()
void testing::internal::FilePath::Set |
( |
const FilePath & | rhs | ) |
|
|
inline |
◆ string()
const std::string & testing::internal::FilePath::string |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files:
- libraries/fc/include/fc/crypto/webauthn_json/thirdparty/gtest/googletest/include/gtest/internal/gtest-filepath.h
- libraries/fc/include/fc/crypto/webauthn_json/thirdparty/gtest/googletest/src/gtest-filepath.cc