diff options
Diffstat (limited to 'yage/core/iomanager.cpp')
-rw-r--r-- | yage/core/iomanager.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/yage/core/iomanager.cpp b/yage/core/iomanager.cpp index 3d9ea7cb..487ef8a9 100644 --- a/yage/core/iomanager.cpp +++ b/yage/core/iomanager.cpp @@ -10,11 +10,14 @@ #include <fstream> #include <stdexcept> +#include <regex> namespace yage { -bool IoManager::readFileToBuffer(const std::string &file_path, +namespace IoManager { + +bool readFileToBuffer(const std::string &file_path, std::vector<unsigned char> &buffer) { std::ifstream file(file_path, std::ios::binary); @@ -39,4 +42,11 @@ bool IoManager::readFileToBuffer(const std::string &file_path, return true; } +std::string parentDirectory(std::string file_path) +{ + return std::regex_replace(file_path, std::regex("(.*)/.*"), "$1"); +} + +} + } // namespace yage |