From 7c3522da9eb5f248d6ecf4074c0ff578350ea691 Mon Sep 17 00:00:00 2001 From: sfb Date: Mon, 12 Dec 2011 14:38:41 -0600 Subject: [PATCH] Fixed: #1385 patch_gen uses tmpnam function instead of 'nul' for files with no pre-existing version. Note - used tmpnam instead of mkstemp due to cross-platform compatibility. --- code/ryzom/tools/patch_gen/patch_gen_common.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/patch_gen/patch_gen_common.cpp b/code/ryzom/tools/patch_gen/patch_gen_common.cpp index fc39e9fcf..c746fcd00 100644 --- a/code/ryzom/tools/patch_gen/patch_gen_common.cpp +++ b/code/ryzom/tools/patch_gen/patch_gen_common.cpp @@ -18,8 +18,11 @@ // includes //----------------------------------------------------------------------------- +#include + #include "game_share/bnp_patch.h" #include "nel/misc/path.h" +#include "nel/misc/file.h" #include "nel/misc/command.h" #include "nel/misc/sstring.h" #include "game_share/singleton_registry.h" @@ -320,7 +323,6 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const for (uint32 i=packageIndex.fileCount();i--;) { - bool deleteRefAfterDelta= true; // generate file name root std::string bnpFileName= _BnpDirectory+packageIndex.getFile(i).getFileName(); std::string refNameRoot= _RefDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName); @@ -340,8 +342,9 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const std::string prevVersionFileName; if (packageIndex.getFile(i).versionCount()==1) { - prevVersionFileName= "nul"; - deleteRefAfterDelta= false; + prevVersionFileName= tmpnam(NULL); + NLMISC::COFile tmpFile(prevVersionFileName); + tmpFile.close(); } else { @@ -400,7 +403,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const } // if we have a ref file still hanging about from the previous patch then delete it - if (prevVersionFileName!= "nul" && NLMISC::CFile::fileExists(prevVersionFileName)) + if (NLMISC::CFile::fileExists(prevVersionFileName)) { NLMISC::CFile::deleteFile(prevVersionFileName); }