diff options
Diffstat (limited to 'source/Host/posix/FileSystem.cpp')
-rw-r--r-- | source/Host/posix/FileSystem.cpp | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/source/Host/posix/FileSystem.cpp b/source/Host/posix/FileSystem.cpp index 1f2e7db0e1e4..c8fa1bc9cf47 100644 --- a/source/Host/posix/FileSystem.cpp +++ b/source/Host/posix/FileSystem.cpp @@ -54,30 +54,32 @@ FileSystem::MakeDirectory(const FileSpec &file_spec, uint32_t file_permissions) switch (error.GetError()) { case ENOENT: - { - // Parent directory doesn't exist, so lets make it if we can - // Make the parent directory and try again - FileSpec parent_file_spec{file_spec.GetDirectory().GetCString(), false}; - error = MakeDirectory(parent_file_spec, file_permissions); - if (error.Fail()) - return error; - // Try and make the directory again now that the parent directory was made successfully - if (::mkdir(file_spec.GetCString(), file_permissions) == -1) { - error.SetErrorToErrno(); + // Parent directory doesn't exist, so lets make it if we can + // Make the parent directory and try again + FileSpec parent_file_spec{file_spec.GetDirectory().GetCString(), false}; + error = MakeDirectory(parent_file_spec, file_permissions); + if (error.Fail()) + return error; + // Try and make the directory again now that the parent directory was made successfully + if (::mkdir(file_spec.GetCString(), file_permissions) == -1) + { + error.SetErrorToErrno(); + } return error; } - } + break; case EEXIST: - { - if (file_spec.IsDirectory()) - return Error{}; // It is a directory and it already exists - } + { + if (file_spec.IsDirectory()) + return Error(); // It is a directory and it already exists + } + break; } } return error; } - return Error{"empty path"}; + return Error("empty path"); } Error @@ -297,3 +299,15 @@ FileSystem::IsLocal(const FileSpec &spec) return false; } #endif + +FILE * +FileSystem::Fopen(const char *path, const char *mode) +{ + return ::fopen(path, mode); +} + +int +FileSystem::Stat(const char *path, struct stat *stats) +{ + return ::stat(path, stats); +} |