diff options
Diffstat (limited to 'source/core/slang-file-system.cpp')
| -rw-r--r-- | source/core/slang-file-system.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/source/core/slang-file-system.cpp b/source/core/slang-file-system.cpp index 8dd01ebf0..52ec40c07 100644 --- a/source/core/slang-file-system.cpp +++ b/source/core/slang-file-system.cpp @@ -201,26 +201,10 @@ SlangResult OSFileSystem::enumeratePathContents(const char* path, FileSystemCont SlangResult OSFileSystem::saveFile(const char* pathIn, const void* data, size_t size) { SLANG_RETURN_ON_FAIL(_checkMutable(m_style)); - const String path = _fixPathDelimiters(pathIn); - - try - { - FileStream stream(pathIn, FileMode::Create, FileAccess::Write, FileShare::ReadWrite); - - int64_t numWritten = stream.write(data, size); - - if (numWritten != int64_t(size)) - { - return SLANG_FAIL; - } - - } - catch (const IOException&) - { - return SLANG_E_CANNOT_OPEN; - } - + FileStream stream; + SLANG_RETURN_ON_FAIL(stream.init(pathIn, FileMode::Create, FileAccess::Write, FileShare::ReadWrite)); + SLANG_RETURN_ON_FAIL(stream.write(data, size)); return SLANG_OK; } |
