Move pathExists() to Utils.cpp
This is useful as a general utility function.
Change-Id: Id43fc106dc6c544c6e4ce65f10c7d4246b99e54a
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) {