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