Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/sys
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-08-01 19:57:03 +0000
committerStijn Buys <ingar@osirion.org>2008-08-01 19:57:03 +0000
commit089cb5f96e400d4ab7c9d8041cb51eb8f118d9c1 (patch)
tree9799137f41d5104ed4911ac5774f9f50406581d9 /src/sys
parentcc335cfbf13a6b21c5f65febc6049eb5d4c16b63 (diff)
initial make install support
Diffstat (limited to 'src/sys')
-rw-r--r--src/sys/sys.cc14
-rw-r--r--src/sys/sys.h3
2 files changed, 17 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
diff --git a/src/sys/sys.h b/src/sys/sys.h
index e455b82..66040f0 100644
--- a/src/sys/sys.h
+++ b/src/sys/sys.h
@@ -21,6 +21,9 @@ namespace sys
{
typedef void (* signalfunc)(int signum);
+/// check if a path exists and if it is a directory
+bool isdirectory(std::string const &path);
+
/// create a directory
void mkdir(std::string const &path);