Move pathExists() to Utils.cpp

This is useful as a general utility function.

Change-Id: Id43fc106dc6c544c6e4ce65f10c7d4246b99e54a
diff --git a/KeyStorage.cpp b/KeyStorage.cpp
index 89844aa..fb94ae5 100644
--- a/KeyStorage.cpp
+++ b/KeyStorage.cpp
@@ -606,10 +606,6 @@
     return true;
 }
 
-bool pathExists(const std::string& path) {
-    return access(path.c_str(), F_OK) == 0;
-}
-
 bool storeKey(const std::string& dir, const KeyAuthentication& auth, const KeyBuffer& key) {
     if (TEMP_FAILURE_RETRY(mkdir(dir.c_str(), 0700)) == -1) {
         PLOG(ERROR) << "key mkdir " << dir;
diff --git a/KeyStorage.h b/KeyStorage.h
index a69dbf7..a8908d4 100644
--- a/KeyStorage.h
+++ b/KeyStorage.h
@@ -43,9 +43,6 @@
 
 extern const KeyAuthentication kEmptyAuthentication;
 
-// Checks if path "path" exists.
-bool pathExists(const std::string& path);
-
 bool createSecdiscardable(const std::string& path, std::string* hash);
 bool readSecdiscardable(const std::string& path, std::string* hash);
 
diff --git a/Utils.cpp b/Utils.cpp
index 98797b2..c74feb4 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -1349,6 +1349,10 @@
     return -1;
 }
 
+bool pathExists(const std::string& path) {
+    return access(path.c_str(), F_OK) == 0;
+}
+
 bool FsyncDirectory(const std::string& dirname) {
     android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(dirname.c_str(), O_RDONLY | O_CLOEXEC)));
     if (fd == -1) {
diff --git a/Utils.h b/Utils.h
index a727e63..cf85136 100644
--- a/Utils.h
+++ b/Utils.h
@@ -179,6 +179,8 @@
 
 status_t WaitForFile(const char* filename, std::chrono::nanoseconds timeout);
 
+bool pathExists(const std::string& path);
+
 bool FsyncDirectory(const std::string& dirname);
 
 bool writeStringToFile(const std::string& payload, const std::string& filename);