Changed: Minor changes

--HG--
branch : develop
This commit is contained in:
kervala 2015-12-13 20:23:58 +01:00
parent 8b9098b5d5
commit 7977ef5903
2 changed files with 11 additions and 11 deletions

View file

@ -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;
} }

View file

@ -96,7 +96,7 @@ 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
@ -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