gearmulator

Emulation of classic VA synths of the late 90s/2000s that are based on Motorola 56300 family DSPs
Log | Files | Refs | Submodules | README | LICENSE

commit 18c646034759a225c3f6bdd7ea697605e5ff20b0
parent e4e604d6d6ed4dd8040785072a46c00b510092b8
Author: dsp56300 <dsp56300@users.noreply.github.com>
Date:   Sat, 26 Oct 2024 23:04:29 +0200

fix createDirectory not being recursive on Mac/Linux

Diffstat:
Msource/synthLib/os.cpp | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/source/synthLib/os.cpp b/source/synthLib/os.cpp @@ -119,7 +119,16 @@ namespace synthLib bool createDirectory(const std::string& _dir) { #ifdef USE_DIRENT - return mkdir(_dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == 0; + constexpr auto dirAttribs = S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH; + for(size_t i=0; i<_dir.size(); ++i) + { + if(_dir[i] == '/' || _dir[i] == '\\') + { + const auto d = _dir.substr(0,i); + mkdir(d.c_str(), dirAttribs); + } + } + return mkdir(_dir.c_str(), dirAttribs) == 0; #else return std::filesystem::create_directories(_dir); #endif