MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / CreateFolder

Method CreateFolder

rtpose_wrapper/src/gtest/gtest-all.cpp:7745–7761  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

7743// directory for any reason, including if the parent directory does not
7744// exist. Not named "CreateDirectory" because that's a macro on Windows.
7745bool FilePath::CreateFolder() const {
7746#if GTEST_OS_WINDOWS_MOBILE
7747 FilePath removed_sep(this->RemoveTrailingPathSeparator());
7748 LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
7749 int result = CreateDirectory(unicode, NULL) ? 0 : -1;
7750 delete [] unicode;
7751#elif GTEST_OS_WINDOWS
7752 int result = _mkdir(pathname_.c_str());
7753#else
7754 int result = mkdir(pathname_.c_str(), 0777);
7755#endif // GTEST_OS_WINDOWS_MOBILE
7756
7757 if (result == -1) {
7758 return this->DirectoryExists(); // An error is OK if the directory exists.
7759 }
7760 return true; // No error.
7761}
7762
7763// If input name has a trailing separator character, remove it and return the
7764// name, otherwise return the name string unmodified.

Callers 1

Calls 2

DirectoryExistsMethod · 0.95

Tested by

no test coverage detected