MCPcopy Create free account
hub / github.com/BVLC/caffe / DirectoryExists

Method DirectoryExists

src/gtest/gtest-all.cpp:7643–7669  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

7641// Returns true if pathname describes a directory in the file-system
7642// that exists.
7643bool FilePath::DirectoryExists() const {
7644 bool result = false;
7645#if GTEST_OS_WINDOWS
7646 // Don't strip off trailing separator if path is a root directory on
7647 // Windows (like "C:\\").
7648 const FilePath& path(IsRootDirectory() ? *this :
7649 RemoveTrailingPathSeparator());
7650#else
7651 const FilePath& path(*this);
7652#endif
7653
7654#if GTEST_OS_WINDOWS_MOBILE
7655 LPCWSTR unicode = String::AnsiToUtf16(path.c_str());
7656 const DWORD attributes = GetFileAttributes(unicode);
7657 delete [] unicode;
7658 if ((attributes != kInvalidFileAttributes) &&
7659 (attributes & FILE_ATTRIBUTE_DIRECTORY)) {
7660 result = true;
7661 }
7662#else
7663 posix::StatStruct file_stat;
7664 result = posix::Stat(path.c_str(), &file_stat) == 0 &&
7665 posix::IsDir(file_stat);
7666#endif // GTEST_OS_WINDOWS_MOBILE
7667
7668 return result;
7669}
7670
7671// Returns true if pathname describes a root directory. (Windows has one
7672// root directory per disk drive.)

Callers 2

CreateFolderMethod · 0.95

Calls 2

StatFunction · 0.85
IsDirFunction · 0.85

Tested by

no test coverage detected