From 50bd7363e4373a3c2a59f7dae695f6f93f5aa51b Mon Sep 17 00:00:00 2001 From: mikee47 Date: Fri, 30 Aug 2024 10:49:34 +0100 Subject: [PATCH] Add `EEXIST` to common host errors, don't fail when creating directories --- src/FileSystem.cpp | 2 +- src/HostUtil.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/FileSystem.cpp b/src/FileSystem.cpp index 3a909bd..c5f74f2 100644 --- a/src/FileSystem.cpp +++ b/src/FileSystem.cpp @@ -174,7 +174,7 @@ int FileSystem::makedirs(const char* path) while((i = s.indexOf('/', i)) > 0) { s[i] = '\0'; int err = mkdir(s.c_str()); - if(err < 0) { + if(err < 0 && err != Error::Exists) { return err; } s[i++] = '/'; diff --git a/src/HostUtil.cpp b/src/HostUtil.cpp index e19a9a1..6bfc156 100644 --- a/src/HostUtil.cpp +++ b/src/HostUtil.cpp @@ -72,6 +72,8 @@ int mapFlags(OpenFlags flags) int syserr() { switch(errno) { + case EEXIST: + return Error::Exists; case EPERM: case EACCES: return Error::Denied;