Skip to content

Commit

Permalink
wzmaplib: Fix game.js output when exporting package files
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jan 29, 2025
1 parent 6847a65 commit 028c03f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/wzmaplib/src/map_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,12 @@ bool MapPackage::exportMapPackageFiles(std::string basePath, LevelFormat levelFo
debug(pCustomLogger, LOG_ERROR, "Failed to script contents from source map");
return false;
}
if (!exportIO->writeFullFile(gameJSOutputPath, pScriptData->data(), static_cast<uint32_t>(pScriptData->size())))
size_t gameJSFileSize = pScriptData->size();
if (gameJSFileSize > 0 && (pScriptData->back() == 0))
{
--gameJSFileSize; // do not write out the extra null terminator added when loading the script contents
}
if (!exportIO->writeFullFile(gameJSOutputPath, pScriptData->data(), static_cast<uint32_t>(gameJSFileSize)))
{
// Failed writing file
debug(pCustomLogger, LOG_ERROR, "Failed writing game.js to destination: %s", gameJSOutputPath.c_str());
Expand Down

0 comments on commit 028c03f

Please sign in to comment.