Changed: Minor changes

This commit is contained in:
kervala 2014-03-23 20:36:46 +01:00
parent c0e10e4a5d
commit c325eaaacb

View file

@ -34,8 +34,8 @@
#ifdef USE_CURL
#include <curl/curl.h>
#endif
#include <zlib.h>
#include <zlib.h>
#include "nel/misc/debug.h"
#include "nel/misc/path.h"
@ -92,6 +92,7 @@ extern std::string ClientLauncherUrl;
#else
std::string TheTmpInstallDirectory = "patch/client_install";
#endif
// ****************************************************************************
// ****************************************************************************
// ****************************************************************************
@ -259,16 +260,20 @@ void CPatchManager::init(const std::vector<std::string>& patchURIs, const std::s
try
{
CConfigFile *cf;
#ifdef RY_BG_DOWNLOADER
cf = &theApp.ConfigFile;
#else
cf = &ClientCfg.ConfigFile;
#endif
std::string appName = "ryzom_live";
if (cf->getVarPtr("Application"))
{
appName = cf->getVar("Application").asString(0);
}
std::string versionFileName = appName + ".version";
getServerFile(versionFileName);
@ -282,6 +287,7 @@ void CPatchManager::init(const std::vector<std::string>& patchURIs, const std::s
#ifdef NL_DEBUG
CConfigFile::CVar *forceVersion = cf->getVarPtr("ForceVersion");
if (forceVersion != NULL)
{
line = forceVersion->asString();
@ -740,6 +746,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
string err = toString("Can't open file '%s' for writing: code=%d %s (error code 29)", UpdateBatchFilename.c_str(), errno, strerror(errno));
throw Exception (err);
}
//use bat if windows if not use sh
#ifdef NL_OS_WINDOWS
fprintf(fp, "@echo off\n");
@ -777,6 +784,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
throw;
}
if (!result)
{
//:TODO: handle exception?
@ -796,15 +804,13 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
string SrcPath = ClientPatchPath;
string DstPath = rCat.getUnpackTo();
NLMISC::CFile::createDirectoryTree(DstPath);
// this file must be moved
// this file must be moved
if (useBatchFile)
{
#ifdef NL_OS_WINDOWS
SrcPath = CPath::standardizeDosPath(SrcPath);
DstPath = CPath::standardizeDosPath(DstPath);
#elif NL_OS_MAC
//no patcher on mac yet
#else
SrcPath = CPath::standardizePath(SrcPath);
DstPath = CPath::standardizePath(DstPath);
@ -852,14 +858,13 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
vector<string> vFileList;
CPath::getPathContent ("patch", false, false, true, vFileList, NULL, false);
for(uint32 i = 0; i < vFileList.size(); ++i)
{
if (useBatchFile)
{
#ifdef NL_OS_WINDOWS
fprintf(fp, "del %s\n", CPath::standardizeDosPath(vFileList[i]).c_str());
#elif NL_OS_MAC
//no patcher on MAC yet
#else
fprintf(fp, "rm -f %s\n", CPath::standardizePath(vFileList[i]).c_str());
#endif
@ -875,8 +880,6 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
#ifdef NL_OS_WINDOWS
fprintf(fp, "rd /Q /S patch\n");
fprintf(fp, "if exist patch goto looppatch\n");
#elif NL_OS_MAC
//no patcher on mac yet
#else
fprintf(fp, "rm -rf patch\n");
#endif
@ -970,9 +973,11 @@ void CPatchManager::executeBatchFile()
#else
// Start the child process.
bool r2Mode = false;
#ifndef RY_BG_DOWNLOADER
r2Mode = ClientCfg.R2Mode;
#endif
string strCmdLine;
strCmdLine = "./" + UpdateBatchFilename;
@ -2132,9 +2137,7 @@ void CPatchManager::getCorruptedFileInfo(const SFileToPatch &ftp, ucstring &sTra
bool CPatchManager::unpack7Zip(const std::string &sevenZipFile, const std::string &destFileName)
{
#ifdef RZ_USE_SEVENZIP
nlinfo("Uncompressing 7zip archive '%s' to '%s'",
sevenZipFile.c_str(),
destFileName.c_str());
nlinfo("Uncompressing 7zip archive '%s' to '%s'", sevenZipFile.c_str(), destFileName.c_str());
// init seven zip
ISzAlloc allocImp;