diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-10-04 14:15:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-04 14:15:51 -0400 |
| commit | 97bb82ebcdf8f1391b9d93b5a8d7b1dfc4e88e52 (patch) | |
| tree | f120ba282cbea96d23ed179737984a4610d3b520 /source/core/slang-file-system.cpp | |
| parent | b3dfe383c6d31ff3dbd76dcfb32de8d536382f3e (diff) | |
Removing exceptions from core/compiler-core (#1953)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Refactor Stream. Working on all tests.
* Split out CharEncode.
* Make method names lower camel.
m_prefix in Writer/Reader
* Tidy up around CharEncode interface.
* Small improvements around encode/decode.
* Better use of types.
* Remove readLine from TextReader.
* Remove exceptions from Stream/Text handling.
* Fix some typos.
* Fix tabbing.
* Fix missing override.
* Remove remaining exception throw/catch via using signal mechanism.
* Remove exceptions that are not used anymore.
* Document the Stream interface.
* Remove index for decoding 'get byte' function.
* Fix CharReader -> ByteReader.
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; } |
