SCPathExists - function to see if a path exists

Returns true if path exists, otherwise false.
pull/3175/head
Jason Ish 8 years ago
parent c0ffe4055a
commit 38bbdb51d5

@ -120,3 +120,20 @@ int SCCreateDirectoryTree(const char *path, const bool final)
return 0;
}
/**
* \brief Check if a path exists.
*
* \param Path to check for existence
*
* \retval true if path exists
* \retval false if path does not exist
*/
bool SCPathExists(const char *path)
{
struct stat sb;
if (stat(path, &sb) == 0) {
return true;
}
return false;
}

@ -35,5 +35,6 @@ int PathIsAbsolute(const char *);
int PathIsRelative(const char *);
int SCDefaultMkDir(const char *path);
int SCCreateDirectoryTree(const char *path, const bool final);
bool SCPathExists(const char *path);
#endif /* __UTIL_PATH_H__ */

Loading…
Cancel
Save