Changed: Minor changes

--HG--
branch : develop
This commit is contained in:
kervala 2016-02-21 13:16:04 +01:00
parent 24dda2e7b9
commit bfe817f92c

View file

@ -743,7 +743,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
{ {
// For all optional categories check if there is a 'file to patch' in it // For all optional categories check if there is a 'file to patch' in it
const CBNPCategory &rCat = rDescCats.getCategory(i); const CBNPCategory &rCat = rDescCats.getCategory(i);
nlwarning("Category = %s", rCat.getName().c_str());
nlinfo("Category = %s", rCat.getName().c_str());
if (!rCat.getUnpackTo().empty()) if (!rCat.getUnpackTo().empty())
for (uint32 j = 0; j < rCat.fileCount(); ++j) for (uint32 j = 0; j < rCat.fileCount(); ++j)
{ {
@ -753,7 +755,9 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
// Extract to patch // Extract to patch
vector<string> vFilenames; vector<string> vFilenames;
bool result = false; bool result = false;
try try
{ {
result = bnpUnpack(rFilename, ClientPatchPath, vFilenames); result = bnpUnpack(rFilename, ClientPatchPath, vFilenames);
@ -806,6 +810,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
{ {
batchRelativeDstPath = fullDstPath + FileName; batchRelativeDstPath = fullDstPath + FileName;
} }
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// only fix backslashes for .bat // only fix backslashes for .bat
batchRelativeDstPath = CPath::standardizeDosPath(batchRelativeDstPath); batchRelativeDstPath = CPath::standardizeDosPath(batchRelativeDstPath);
@ -825,7 +830,6 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
string realSrcPath = toString("\"$UNPACKPATH\\%s\"", FileName.c_str()); string realSrcPath = toString("\"$UNPACKPATH\\%s\"", FileName.c_str());
content += toString("rm -rf %s\n", realDstPath.c_str()); content += toString("rm -rf %s\n", realDstPath.c_str());
// TODO: add test of returned $?
content += toString("mv %s %s\n", realSrcPath.c_str(), realDstPath.c_str()); content += toString("mv %s %s\n", realSrcPath.c_str(), realDstPath.c_str());
#endif #endif
@ -872,7 +876,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
if (!patchContent.empty()) if (!patchContent.empty())
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
content += toString(":looppatch\n"); content += ":looppatch\n";
content += patchContent; content += patchContent;
@ -892,8 +896,10 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
{ {
deleteBatchFile(); deleteBatchFile();
// batch full path
std::string batchFilename = ClientRootPath + UpdateBatchFilename; std::string batchFilename = ClientRootPath + UpdateBatchFilename;
// write windows .bat format else write sh format
FILE *fp = nlfopen (batchFilename, "wt"); FILE *fp = nlfopen (batchFilename, "wt");
if (fp == NULL) if (fp == NULL)