[ox/fs] Make PassthroughFS mkdir pass mkdir -p on existing directory

This commit is contained in:
Gary Talent 2020-06-16 04:39:15 -05:00
parent e92e980fde
commit f58c658be1

View File

@ -7,6 +7,7 @@
*/ */
#include "passthroughfs.hpp" #include "passthroughfs.hpp"
#include <filesystem>
#if defined(OX_HAS_PASSTHROUGHFS) #if defined(OX_HAS_PASSTHROUGHFS)
@ -31,7 +32,11 @@ Error PassThroughFS::mkdir(const char *path, bool recursive) {
const auto u8p = p.u8string(); const auto u8p = p.u8string();
oxTrace("ox::fs::PassThroughFS::mkdir") << u8p.c_str(); oxTrace("ox::fs::PassThroughFS::mkdir") << u8p.c_str();
if (recursive) { if (recursive) {
if (std::filesystem::is_directory(p)) {
success = true;
} else {
success = std::filesystem::create_directories(p); success = std::filesystem::create_directories(p);
}
} else { } else {
success = std::filesystem::create_directory(p); success = std::filesystem::create_directory(p);
} }