Skip to content
Permalink
Browse files

COMMON: Implement createDirectory() method to Common::FSNode

Added a simple wrapper for AbstractFSNode::create(true) since there was
no way to create directories.
  • Loading branch information...
lolbot-iichan authored and bluegr committed Jun 29, 2019
1 parent d8dc31a commit f1250dbfcb4fe0c7431c9b928e9f12c2d16aadd2
Showing with 20 additions and 0 deletions.
  1. +11 −0 common/fs.cpp
  2. +9 −0 common/fs.h
@@ -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) {
}
@@ -230,6 +230,15 @@ class FSNode : public ArchiveMember {
* @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;
};

/**

0 comments on commit f1250db

Please sign in to comment.
You can’t perform that action at this time.