aboutsummaryrefslogtreecommitdiffstats
path: root/yage
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-04-06 15:38:13 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-04-06 15:38:13 +0100
commit52fae93d2903fc606bb0c4347a994a1b1285835b (patch)
treea58a595c55d429c13368e8e216a573af92952605 /yage
parent4416e0b3a3245f77bd8dde7d2bba80743c6fa20b (diff)
downloadYAGE-52fae93d2903fc606bb0c4347a994a1b1285835b.tar.gz
YAGE-52fae93d2903fc606bb0c4347a994a1b1285835b.zip
Fixing documentation and building
Diffstat (limited to 'yage')
-rw-r--r--yage/core/iomanager.cpp12
-rw-r--r--yage/core/iomanager.h13
2 files changed, 19 insertions, 6 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
diff --git a/yage/core/iomanager.h b/yage/core/iomanager.h
index 6c623adf..556cffb4 100644
--- a/yage/core/iomanager.h
+++ b/yage/core/iomanager.h
@@ -15,12 +15,15 @@
namespace yage
{
-class IoManager
+namespace IoManager
{
-public:
- static bool readFileToBuffer(const std::string &file_path,
- std::vector<unsigned char> &buffer);
-};
+
+extern bool readFileToBuffer(const std::string &file_path,
+ std::vector<unsigned char> &buffer);
+
+extern std::string parentDirectory(std::string file_path);
+
+}
} // namespace yage