|
|
|
@ -78,7 +78,7 @@ void GenerateLZMA(const std::string sourceFile, const std::string &outputFile)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// old syntax incompatible with new versions
|
|
|
|
|
std::string cmd = "lzma e ";
|
|
|
|
|
std::string cmd = "lzma e";
|
|
|
|
|
cmd += " " + sourceFile + " " + outputFile;
|
|
|
|
|
nlinfo("Executing system command: %s", cmd.c_str());
|
|
|
|
|
}
|
|
|
|
@ -194,31 +194,31 @@ void CPackageDescription::setup(const std::string& packageName)
|
|
|
|
|
|
|
|
|
|
// root directory
|
|
|
|
|
if (_RootDirectory.empty())
|
|
|
|
|
_RootDirectory= NLMISC::CFile::getPath(packageName);
|
|
|
|
|
_RootDirectory= NLMISC::CPath::standardizePath(_RootDirectory,true);
|
|
|
|
|
_RootDirectory = NLMISC::CFile::getPath(packageName);
|
|
|
|
|
_RootDirectory = NLMISC::CPath::standardizePath(_RootDirectory, true);
|
|
|
|
|
|
|
|
|
|
// patch directory
|
|
|
|
|
if (_PatchDirectory.empty())
|
|
|
|
|
_PatchDirectory= _RootDirectory+"patch";
|
|
|
|
|
_PatchDirectory= NLMISC::CPath::standardizePath(_PatchDirectory,true);
|
|
|
|
|
_PatchDirectory = _RootDirectory + "patch";
|
|
|
|
|
_PatchDirectory = NLMISC::CPath::standardizePath(_PatchDirectory, true);
|
|
|
|
|
|
|
|
|
|
// BNP directory
|
|
|
|
|
if (_BnpDirectory.empty())
|
|
|
|
|
_BnpDirectory= _RootDirectory+"bnp";
|
|
|
|
|
_BnpDirectory= NLMISC::CPath::standardizePath(_BnpDirectory,true);
|
|
|
|
|
_BnpDirectory = _RootDirectory+"bnp";
|
|
|
|
|
_BnpDirectory = NLMISC::CPath::standardizePath(_BnpDirectory, true);
|
|
|
|
|
|
|
|
|
|
// ref directory
|
|
|
|
|
if (_RefDirectory.empty())
|
|
|
|
|
_RefDirectory= _RootDirectory+"ref";
|
|
|
|
|
_RefDirectory= NLMISC::CPath::standardizePath(_RefDirectory,true);
|
|
|
|
|
_RefDirectory = _RootDirectory+"ref";
|
|
|
|
|
_RefDirectory = NLMISC::CPath::standardizePath(_RefDirectory, true);
|
|
|
|
|
|
|
|
|
|
// client index file
|
|
|
|
|
if (_ClientIndexFileName.empty())
|
|
|
|
|
_ClientIndexFileName= NLMISC::CFile::getFilenameWithoutExtension(packageName)+".idx";
|
|
|
|
|
_ClientIndexFileName = NLMISC::CFile::getFilenameWithoutExtension(packageName)+".idx";
|
|
|
|
|
|
|
|
|
|
// index file
|
|
|
|
|
if (_IndexFileName.empty())
|
|
|
|
|
_IndexFileName= NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName)+".hist";
|
|
|
|
|
_IndexFileName = NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName)+".hist";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CPackageDescription::storeToPdr(CPersistentDataRecord& pdr) const
|
|
|
|
@ -348,14 +348,14 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
|
|
|
|
{
|
|
|
|
|
nlinfo("Generating patches ...");
|
|
|
|
|
|
|
|
|
|
for (uint32 i=packageIndex.fileCount();i--;)
|
|
|
|
|
for (uint32 i = packageIndex.fileCount(); i--;)
|
|
|
|
|
{
|
|
|
|
|
bool deleteRefAfterDelta= true;
|
|
|
|
|
bool deleteRefAfterDelta = true;
|
|
|
|
|
bool usingTemporaryFile = false;
|
|
|
|
|
// generate file name root
|
|
|
|
|
std::string bnpFileName= _BnpDirectory+packageIndex.getFile(i).getFileName();
|
|
|
|
|
std::string refNameRoot= _RefDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
std::string patchNameRoot= _PatchDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
std::string bnpFileName = _BnpDirectory + packageIndex.getFile(i).getFileName();
|
|
|
|
|
std::string refNameRoot = _RefDirectory + NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
std::string patchNameRoot = _PatchDirectory + NLMISC::CFile::getFilenameWithoutExtension(bnpFileName);
|
|
|
|
|
|
|
|
|
|
// if the file has no versions then skip on to the next file
|
|
|
|
|
if (packageIndex.getFile(i).versionCount()==0)
|
|
|
|
@ -365,7 +365,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
|
|
|
|
const CBNPFileVersion& curVersion= packageIndex.getFile(i).getVersion(packageIndex.getFile(i).versionCount()-1);
|
|
|
|
|
std::string curVersionFileName= refNameRoot+NLMISC::toString("_%05u.%s",curVersion.getVersionNumber(),NLMISC::CFile::getExtension(bnpFileName).c_str());
|
|
|
|
|
// std::string patchFileName= patchNameRoot+NLMISC::toString("_%05d.patch",curVersion.getVersionNumber());
|
|
|
|
|
std::string patchFileName= _PatchDirectory+toString("%05u/",curVersion.getVersionNumber())+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+toString("_%05u",curVersion.getVersionNumber())+".patch";
|
|
|
|
|
std::string patchFileName= _PatchDirectory + toString("%05u/",curVersion.getVersionNumber())+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+toString("_%05u",curVersion.getVersionNumber())+".patch";
|
|
|
|
|
|
|
|
|
|
// get the second last version number and the related file name
|
|
|
|
|
std::string prevVersionFileName;
|
|
|
|
@ -413,7 +413,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
|
|
|
|
refVersionFileName= _BnpDirectory+NLMISC::CFile::getFilenameWithoutExtension(bnpFileName)+"_.ref";
|
|
|
|
|
|
|
|
|
|
// delete the previous patch - because we only need the latest patch for non-incremental files
|
|
|
|
|
std::string lastPatch= _PatchDirectory+NLMISC::CFile::getFilenameWithoutExtension(prevVersionFileName)+".patch";
|
|
|
|
|
std::string lastPatch= _PatchDirectory + NLMISC::CFile::getFilenameWithoutExtension(prevVersionFileName)+".patch";
|
|
|
|
|
if (NLMISC::CFile::fileExists(lastPatch.c_str()))
|
|
|
|
|
NLMISC::CFile::deleteFile(lastPatch.c_str());
|
|
|
|
|
}
|
|
|
|
@ -563,7 +563,7 @@ static bool createNewProduct(std::string fileName)
|
|
|
|
|
pdr.writeToTxtFile(fileName);
|
|
|
|
|
|
|
|
|
|
BOMB_IF(!NLMISC::CFile::fileExists(fileName),("Failed to create new package file: "+fileName).c_str(),return false);
|
|
|
|
|
nlinfo("New package description file created successfully: %s",fileName.c_str());
|
|
|
|
|
nlinfo("New package description file created successfully: %s", fileName.c_str());
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|