diff options
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-io.cpp | 7 | ||||
| -rw-r--r-- | source/core/slang-io.h | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp index c11ba85e0..17cd60160 100644 --- a/source/core/slang-io.cpp +++ b/source/core/slang-io.cpp @@ -101,7 +101,8 @@ namespace Slang char* chars = tempFileName.prepareForAppend(count); // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettempfilenamea - // Generates a temporary file name. + // Generates a temporary file name. + // Will create a file with this name. DWORD ret = ::GetTempFileNameA(tempPath.getBuffer(), prefix.getBuffer(), 0, chars); if (ret == 0) @@ -111,6 +112,8 @@ namespace Slang tempFileName.appendInPlace(chars, ::strlen(chars)); } + SLANG_ASSERT(File::exists(tempFileName)); + outFileName = tempFileName; return SLANG_OK; } @@ -135,6 +138,8 @@ namespace Slang close(handle); outFileName = buffer.getBuffer(); + SLANG_ASSERT(File::exists(outFileName)); + return SLANG_OK; } #endif diff --git a/source/core/slang-io.h b/source/core/slang-io.h index 51b1d45e5..43812aaf9 100644 --- a/source/core/slang-io.h +++ b/source/core/slang-io.h @@ -27,6 +27,9 @@ namespace Slang static SlangResult makeExecutable(const String& fileName); + /// Creates a temporary file typically in some way based on the prefix + /// The file will be *created* with the outFileName, on success. + /// It's creation in necessary to lock that particular name. static SlangResult generateTemporary(const UnownedStringSlice& prefix, String& outFileName); }; |
