This is useful as a general utility function.
Change-Id: Id43fc106dc6c544c6e4ce65f10c7d4246b99e54a
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;
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);
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) {
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);