From f2280a6b02168b110263121ffa9deb23f646beb4 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Tue, 1 Nov 2011 10:57:51 +0000 Subject: [PATCH] + bool makeDirectory(const string &path); --- src/common/pathTools.cpp | 5 +++++ src/common/pathTools.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/common/pathTools.cpp b/src/common/pathTools.cpp index d9b737634..356669c3f 100644 --- a/src/common/pathTools.cpp +++ b/src/common/pathTools.cpp @@ -93,3 +93,8 @@ bool fileExists(const string &path) { fin.close(); return flag; } + +bool makeDirectory(const string &path) { + int status = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + return status == 0; +} diff --git a/src/common/pathTools.h b/src/common/pathTools.h index bf7e9aba0..68f3dc0a4 100644 --- a/src/common/pathTools.h +++ b/src/common/pathTools.h @@ -38,5 +38,6 @@ string removeLastPathElement(const string path, const bool removePreSeparator = unsigned int getFileSize(const string &path); string getFileSizeAsString(const string &path); bool fileExists(const string &path); +bool makeDirectory(const string &path); #endif