diff --git a/lib/libfnd/include/fnd/io.h b/lib/libfnd/include/fnd/io.h index d5ace2a..78c1cc0 100644 --- a/lib/libfnd/include/fnd/io.h +++ b/lib/libfnd/include/fnd/io.h @@ -11,5 +11,6 @@ namespace fnd void readFile(const std::string& path, size_t offset, size_t len, MemoryBlob& blob); void writeFile(const std::string& path, const MemoryBlob& blob); void writeFile(const std::string& path, const byte_t* data, size_t len); + void makeDirectory(const std::string& path); } } diff --git a/lib/libfnd/source/io.cpp b/lib/libfnd/source/io.cpp index 816190f..34f9dce 100644 --- a/lib/libfnd/source/io.cpp +++ b/lib/libfnd/source/io.cpp @@ -1,5 +1,10 @@ #include #include +#ifdef _WIN32 +#include +#else +#include +#endif using namespace fnd; @@ -125,3 +130,12 @@ void io::writeFile(const std::string & path, const byte_t * data, size_t len) fclose(fp); } + +void io::makeDirectory(const std::string& path) +{ +#ifdef _WIN32 + _mkdir(path.c_str()); +#else + mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +#endif +} \ No newline at end of file