diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index 9d6b8c8e..3ec86754 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -20,10 +20,10 @@ PassThroughFS::PassThroughFS(const char *dirPath) { m_path = dirPath; } -PassThroughFS::~PassThroughFS() { +PassThroughFS::~PassThroughFS() noexcept { } -String PassThroughFS::basePath() { +String PassThroughFS::basePath() const noexcept { return m_path.string().c_str(); } @@ -43,8 +43,14 @@ Error PassThroughFS::mkdir(const char *path, bool recursive) noexcept { } } else { std::error_code ec; - success = std::filesystem::create_directory(p, ec); - oxReturnError(OxError(ec.value(), "PassThroughFS: mkdir failed")); + const auto isDir = std::filesystem::is_directory(p, ec); + if (isDir) { + success = true; + } else { + std::error_code ec; + success = std::filesystem::create_directory(p, ec); + oxReturnError(OxError(ec.value(), "PassThroughFS: mkdir failed")); + } } return OxError(success ? 0 : 1); } diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp index 55763364..7e2ca50a 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.hpp @@ -32,10 +32,10 @@ class PassThroughFS: public FileSystem { public: explicit PassThroughFS(const char *dirPath); - ~PassThroughFS() override; + ~PassThroughFS() noexcept override; [[nodiscard]] - String basePath(); + String basePath() const noexcept; Error mkdir(const char *path, bool recursive = false) noexcept override;