mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
0ff606bfe2
2 changed files with 13 additions and 13 deletions
|
@ -61,19 +61,19 @@ namespace STAT_GLOBALS
|
||||||
NLMISC::CSString getInputFilePath(const NLMISC::CSString& path)
|
NLMISC::CSString getInputFilePath(const NLMISC::CSString& path)
|
||||||
{
|
{
|
||||||
NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(InputFileDirectory.get());
|
NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(InputFileDirectory.get());
|
||||||
return (path.left((uint)pathRoot.size())==pathRoot)? path: pathRoot+path;
|
return path.left((uint)pathRoot.size()) == pathRoot ? path:pathRoot+path;
|
||||||
}
|
}
|
||||||
|
|
||||||
NLMISC::CSString getScriptFilePath(const NLMISC::CSString& path)
|
NLMISC::CSString getScriptFilePath(const NLMISC::CSString& path)
|
||||||
{
|
{
|
||||||
NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(ScriptDirectory.get());
|
NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(ScriptDirectory.get());
|
||||||
return (path.left((uint)pathRoot.size())==pathRoot)? path: pathRoot+path;
|
return path.left((uint)pathRoot.size()) == pathRoot ? path:pathRoot+path;
|
||||||
}
|
}
|
||||||
|
|
||||||
NLMISC::CSString getOutputFilePath(const NLMISC::CSString& path)
|
NLMISC::CSString getOutputFilePath(const NLMISC::CSString& path)
|
||||||
{
|
{
|
||||||
NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(OutputDirectory.get());
|
NLMISC::CSString pathRoot= NLMISC::CPath::standardizePath(OutputDirectory.get());
|
||||||
return (path.left((uint)pathRoot.size())==pathRoot)? path: pathRoot+path;
|
return path.left((uint)pathRoot.size()) == pathRoot ? path:pathRoot+path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ void GenerateLZMA(const std::string sourceFile, const std::string &outputFile)
|
||||||
_spawnlp(_P_WAIT, "lzma.exe","lzma.exe", "e", sourceFile.c_str(), outputFile.c_str(), NULL);
|
_spawnlp(_P_WAIT, "lzma.exe","lzma.exe", "e", sourceFile.c_str(), outputFile.c_str(), NULL);
|
||||||
#else // NL_OS_WINDOWS
|
#else // NL_OS_WINDOWS
|
||||||
// new lzma only supports one file name on command line, so make a copy
|
// new lzma only supports one file name on command line, so make a copy
|
||||||
CFile::copyFile(sourceFile, outputFile);
|
CFile::copyFile(outputFile, sourceFile);
|
||||||
|
|
||||||
// new lzma syntax, -z = compress, -9 = best compression
|
// new lzma syntax, -z = compress, -9 = best compression
|
||||||
std::string cmd = NLMISC::toString("lzma -z -9 %s", outputFile.c_str());
|
std::string cmd = NLMISC::toString("lzma -z -9 %s", outputFile.c_str());
|
||||||
|
@ -96,13 +96,13 @@ void GenerateLZMA(const std::string sourceFile, const std::string &outputFile)
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
nlwarning("'%s' failed with error code %d", cmd.c_str(), error);
|
nlwarning("'%s' failed with error code %d", cmd.c_str(), error);
|
||||||
|
|
||||||
CFile::deleteFile(outputFile);
|
CFile::deleteFile(outputFile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// lzma always append a .lzma extension, so rename compressed file to wanted one
|
// lzma always append a .lzma extension, so rename compressed file to wanted one
|
||||||
CFile::moveFile(outputFile + ".lzma", outputFile);
|
CFile::moveFile(outputFile, outputFile + ".lzma");
|
||||||
}
|
}
|
||||||
#endif // NL_OS_WINDOWS
|
#endif // NL_OS_WINDOWS
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ public:
|
||||||
void getCategories(CPersistentDataRecord &pdr) const;
|
void getCategories(CPersistentDataRecord &pdr) const;
|
||||||
|
|
||||||
void updateIndexFileList(CBNPFileSet& packageIndex) const;
|
void updateIndexFileList(CBNPFileSet& packageIndex) const;
|
||||||
void generateClientIndex(CProductDescriptionForClient& theClientPackage,const CBNPFileSet& packageIndex) const;
|
void generateClientIndex(CProductDescriptionForClient& theClientPackage,const CBNPFileSet& packageIndex) const;
|
||||||
void addVersion(CBNPFileSet& packageIndex);
|
void addVersion(CBNPFileSet& packageIndex);
|
||||||
void generatePatches(CBNPFileSet& packageIndex) const;
|
void generatePatches(CBNPFileSet& packageIndex) const;
|
||||||
void createDirectories() const;
|
void createDirectories() const;
|
||||||
|
@ -193,22 +193,22 @@ void CPackageDescription::setup(const std::string& packageName)
|
||||||
apply(pdr);
|
apply(pdr);
|
||||||
|
|
||||||
// root directory
|
// root directory
|
||||||
if (_RootDirectory.empty())
|
if (_RootDirectory.empty())
|
||||||
_RootDirectory= NLMISC::CFile::getPath(packageName);
|
_RootDirectory= NLMISC::CFile::getPath(packageName);
|
||||||
_RootDirectory= NLMISC::CPath::standardizePath(_RootDirectory,true);
|
_RootDirectory= NLMISC::CPath::standardizePath(_RootDirectory,true);
|
||||||
|
|
||||||
// patch directory
|
// patch directory
|
||||||
if (_PatchDirectory.empty())
|
if (_PatchDirectory.empty())
|
||||||
_PatchDirectory= _RootDirectory+"patch";
|
_PatchDirectory= _RootDirectory+"patch";
|
||||||
_PatchDirectory= NLMISC::CPath::standardizePath(_PatchDirectory,true);
|
_PatchDirectory= NLMISC::CPath::standardizePath(_PatchDirectory,true);
|
||||||
|
|
||||||
// BNP directory
|
// BNP directory
|
||||||
if (_BnpDirectory.empty())
|
if (_BnpDirectory.empty())
|
||||||
_BnpDirectory= _RootDirectory+"bnp";
|
_BnpDirectory= _RootDirectory+"bnp";
|
||||||
_BnpDirectory= NLMISC::CPath::standardizePath(_BnpDirectory,true);
|
_BnpDirectory= NLMISC::CPath::standardizePath(_BnpDirectory,true);
|
||||||
|
|
||||||
// ref directory
|
// ref directory
|
||||||
if (_RefDirectory.empty())
|
if (_RefDirectory.empty())
|
||||||
_RefDirectory= _RootDirectory+"ref";
|
_RefDirectory= _RootDirectory+"ref";
|
||||||
_RefDirectory= NLMISC::CPath::standardizePath(_RefDirectory,true);
|
_RefDirectory= NLMISC::CPath::standardizePath(_RefDirectory,true);
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ void CPackageDescription::generateClientIndex(CProductDescriptionForClient& theC
|
||||||
// create the output file
|
// create the output file
|
||||||
pdr.clear();
|
pdr.clear();
|
||||||
theClientPackage.store(pdr);
|
theClientPackage.store(pdr);
|
||||||
|
|
||||||
std::string newName = _PatchDirectory + toString("%05u/", packageIndex.getVersionNumber()) + NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName);
|
std::string newName = _PatchDirectory + toString("%05u/", packageIndex.getVersionNumber()) + NLMISC::CFile::getFilenameWithoutExtension(_ClientIndexFileName);
|
||||||
newName += NLMISC::toString("_%05u", packageIndex.getVersionNumber());
|
newName += NLMISC::toString("_%05u", packageIndex.getVersionNumber());
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
||||||
string lzmaFile = versionSubDir+CFile::getFilename(bnpFileName)+".lzma";
|
string lzmaFile = versionSubDir+CFile::getFilename(bnpFileName)+".lzma";
|
||||||
if (!CFile::fileExists(lzmaFile))
|
if (!CFile::fileExists(lzmaFile))
|
||||||
{
|
{
|
||||||
// build the lzma compression in a temp file (avoid leaving dirty file if the
|
// build the lzma compression in a temp file (avoid leaving dirty file if the
|
||||||
// process cannot terminate)
|
// process cannot terminate)
|
||||||
GenerateLZMA(bnpFileName, lzmaFile+".tmp");
|
GenerateLZMA(bnpFileName, lzmaFile+".tmp");
|
||||||
// rename the tmp file
|
// rename the tmp file
|
||||||
|
|
Loading…
Reference in a new issue