summaryrefslogtreecommitdiff
path: root/testing/utils
diff options
context:
space:
mode:
Diffstat (limited to 'testing/utils')
-rw-r--r--testing/utils/path_service.cpp11
-rw-r--r--testing/utils/path_service.h3
2 files changed, 9 insertions, 5 deletions
diff --git a/testing/utils/path_service.cpp b/testing/utils/path_service.cpp
index 2ded0ed3b1..5e1ce39602 100644
--- a/testing/utils/path_service.cpp
+++ b/testing/utils/path_service.cpp
@@ -35,7 +35,10 @@ int CallStat(const char* path, stat_wrapper_t* sb) {
}
#endif
-bool DirectoryExists(const std::string& path) {
+} // namespace
+
+// static
+bool PathService::DirectoryExists(const std::string& path) {
#ifdef _WIN32
DWORD fileattr = GetFileAttributesA(path.c_str());
if (fileattr != INVALID_FILE_ATTRIBUTES)
@@ -49,8 +52,6 @@ bool DirectoryExists(const std::string& path) {
#endif
}
-} // namespace
-
// static
bool PathService::EndsWithSeparator(const std::string& path) {
return path.size() > 1 && path[path.size() - 1] == PATH_SEPARATOR;
@@ -127,7 +128,7 @@ bool PathService::GetTestDataDir(std::string* path) {
potential_path.append("testing");
potential_path.push_back(PATH_SEPARATOR);
potential_path.append("resources");
- if (DirectoryExists(potential_path)) {
+ if (PathService::DirectoryExists(potential_path)) {
*path = potential_path;
return true;
}
@@ -140,7 +141,7 @@ bool PathService::GetTestDataDir(std::string* path) {
potential_path.append("testing");
potential_path.push_back(PATH_SEPARATOR);
potential_path.append("resources");
- if (DirectoryExists(potential_path)) {
+ if (PathService::DirectoryExists(potential_path)) {
*path = potential_path;
return true;
}
diff --git a/testing/utils/path_service.h b/testing/utils/path_service.h
index fc0042ca17..63df808dae 100644
--- a/testing/utils/path_service.h
+++ b/testing/utils/path_service.h
@@ -16,6 +16,9 @@
// Get the various file directory and path information.
class PathService {
public:
+ // Return true when the path is a directory that exists.
+ static bool DirectoryExists(const std::string& path);
+
// Return true when the path ends with a path separator.
static bool EndsWithSeparator(const std::string& path);