aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/fs.cpp11
-rw-r--r--common/fs.h9
2 files changed, 20 insertions, 0 deletions
diff --git a/common/fs.cpp b/common/fs.cpp
index 54fdf892f2..4b3ab21eb0 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -152,6 +152,17 @@ WriteStream *FSNode::createWriteStream() const {
return _realNode->createWriteStream();
}
+bool FSNode::createDirectory() const {
+ if (_realNode == nullptr)
+ return false;
+
+ if (_realNode->exists()) {
+ return false;
+ }
+
+ return _realNode->createDirectory();
+}
+
FSDirectory::FSDirectory(const FSNode &node, int depth, bool flat)
: _node(node), _cached(false), _depth(depth), _flat(flat) {
}
diff --git a/common/fs.h b/common/fs.h
index 6ff5c6eb8d..7041428fc8 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -230,6 +230,15 @@ public:
* @return pointer to the stream object, 0 in case of a failure
*/
WriteStream *createWriteStream() const;
+
+ /**
+ * Creates a directory referred by this node. This assumes that this
+ * node refers to non-existing directory. If this is not the case,
+ * false is returned.
+ *
+ * @return true if the directory was created, false otherwise.
+ */
+ bool createDirectory() const;
};
/**