Skip to content
Snippets Groups Projects
Commit 649a22e0 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

fileutils: add isDirectory

The method returns true if given path is a directory filesystem entry

Refs #68196

Change-Id: I983b23aec24e30321483b3f90d0ef9ccacbc515f
parent a3f9cd7b
No related branches found
No related tags found
No related merge requests found
......@@ -214,6 +214,14 @@ expand_path(const std::string &path)
#endif
}
bool isDirectory(const std::string& path)
{
struct stat s;
if (stat(path.c_str(), &s) == 0)
return s.st_mode & S_IFDIR;
return false;
}
bool isDirectoryWritable(const std::string &directory)
{
return access(directory.c_str(), W_OK) == 0;
......
......@@ -67,6 +67,8 @@ namespace ring { namespace fileutils {
bool recursive_mkdir(const std::string& path);
#endif
bool isDirectory(const std::string& path);
/**
* Read content of the directory.
* The result is a list of full paths of files in the directory,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment