Fix crash when creating JSON file that do not exist.
Tested by: @Langbart Refs: #6450 Differential Revision: https://code.wildfiregames.com/D4529 This was SVN commit r26604.
This commit is contained in:
parent
3417669e97
commit
687174e5d9
@ -224,12 +224,14 @@ void WriteJSONFile(const ScriptInterface& scriptInterface, const std::wstring& f
|
||||
VfsPath path(filePath);
|
||||
WriteBuffer buf;
|
||||
buf.Append(str.c_str(), str.length());
|
||||
OsPath realPath;
|
||||
g_VFS->GetRealPath(path, realPath, false);
|
||||
if (g_VFS->CreateFile(path, buf.Data(), buf.Size()) == INFO::OK)
|
||||
{
|
||||
OsPath realPath;
|
||||
g_VFS->GetRealPath(path, realPath, false);
|
||||
debug_printf("FILES| JSON data written to '%s'\n", realPath.string8().c_str());
|
||||
}
|
||||
else
|
||||
debug_printf("FILES| Failed to write JSON data to '%s'\n", realPath.string8().c_str());
|
||||
debug_printf("FILES| Failed to write JSON data to '%s'\n", path.string8().c_str());
|
||||
}
|
||||
|
||||
bool DeleteCampaignSave(const CStrW& filePath)
|
||||
|
Loading…
Reference in New Issue
Block a user