aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-12 19:46:57 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-12 19:49:29 +0100
commitf2c70dfaba8d6481e86646080c51b6874d95f14e (patch)
tree1ee19bdd5f951b86f2b481c94f969a473a5e57fc /include
parentf3b7b7d34b3bf2b1be18914577c96b66dead379a (diff)
Lazily create directories that are needed
Directories such as: ~/.sibs ~/.sibs/archive ~/.sibs/lib And directories for each specific library. Also fix bug in getFileContent and fileOverwrite if file already exists
Diffstat (limited to 'include')
-rw-r--r--include/Archive.hpp1
-rw-r--r--include/FileUtil.hpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/include/Archive.hpp b/include/Archive.hpp
index 6d6a55d..2545f77 100644
--- a/include/Archive.hpp
+++ b/include/Archive.hpp
@@ -8,6 +8,7 @@ namespace sibs
class Archive
{
public:
+ // Note: renames root directory in archive to @destination
static Result<bool> extract(const char *source, const char *destination);
};
}
diff --git a/include/FileUtil.hpp b/include/FileUtil.hpp
index 8407a36..5b91aad 100644
--- a/include/FileUtil.hpp
+++ b/include/FileUtil.hpp
@@ -22,9 +22,11 @@ namespace sibs
void walkDirFiles(const char *directory, FileWalkCallbackFunc callbackFunc);
void walkDirFilesRecursive(const char *directory, FileWalkCallbackFunc callbackFunc);
Result<StringView> getFileContent(const char *filepath);
- bool fileOverwrite(const char *filepath, StringView data);
+ Result<bool> fileOverwrite(const char *filepath, StringView data);
const char* getHomeDir();
Result<std::string> getCwd();
+ // Note: Will not delete created directories if this operation fails for some reason
+ Result<bool> createDirectoryRecursive(const char *path);
}
#endif //SIBS_FILEUTIL_HPP