diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-26 17:33:24 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-26 17:33:24 +0200 |
commit | 61d9e8699687342c2e32c32c8d4eb71760d5d290 (patch) | |
tree | 9fd6ce694d857704ad369ac32f779c19ab4f665d /include/FileUtil.hpp | |
parent | 3a150e29cd1fa63614f45dff01240b01f9c4a025 (diff) |
Use fork/exec instead of popen. Add Path class
Diffstat (limited to 'include/FileUtil.hpp')
-rw-r--r-- | include/FileUtil.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/FileUtil.hpp b/include/FileUtil.hpp index f2a1799..5bd4d33 100644 --- a/include/FileUtil.hpp +++ b/include/FileUtil.hpp @@ -38,6 +38,30 @@ namespace sibs void replaceChar(FileString &input, wchar_t charToReplace, wchar_t charToReplaceWith); #endif + class Path { + public: + Path(const FileString &str) : data(str) {} + + Path& join(const _tinydir_char_t *str) { + data += TINYDIR_STRING("/"); + data += str; + return *this; + } + + Path& join(const Path &other) { + data += TINYDIR_STRING("/"); + data += other.data; + return *this; + } + + Path& append(const FileString &str) { + data += str; + return *this; + } + + FileString data; + }; + // Return true if you want to continue iterating the remaining files, return false if you want to stop using FileWalkCallbackFunc = std::function<bool(tinydir_file*)>; |