diff options
Diffstat (limited to 'src/sys/sys.cc')
-rw-r--r-- | src/sys/sys.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sys/sys.cc b/src/sys/sys.cc index da9b08d..9526166 100644 --- a/src/sys/sys.cc +++ b/src/sys/sys.cc @@ -27,6 +27,20 @@ namespace sys { +bool isdirectory(std::string const &path) +{ + struct stat path_stat; + memset(&path_stat, 0, sizeof(path_stat)); + if (stat(path.c_str(), &path_stat) != 0) + return false; + + if (path_stat.st_mode & S_IFDIR) { + return true; + } + + return false; +} + void mkdir(std::string const &path) { #ifdef _WIN32 |