From afe2148a1745309e41aa4d0a7b198fbca6a0597a Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sun, 2 Jul 2017 00:42:48 -0500 Subject: [PATCH] Fix mkdir not to overwrite an existing dir --- deps/ox/src/ox/fs/filesystem.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deps/ox/src/ox/fs/filesystem.hpp b/deps/ox/src/ox/fs/filesystem.hpp index 0854456e..dcaf41a4 100644 --- a/deps/ox/src/ox/fs/filesystem.hpp +++ b/deps/ox/src/ox/fs/filesystem.hpp @@ -368,8 +368,12 @@ int FileSystemTemplate::stripDirectories() { template int FileSystemTemplate::mkdir(const char *path) { - Directory dir; - return write(path, &dir, sizeof(dir), FileType::FileType_Directory); + if (!stat(path).inode) { + Directory dir; + return write(path, &dir, sizeof(dir), FileType::FileType_Directory); + } else { + return 1; + } } template