From eca33bfb95f08d9be4f06e91ad682958b3f8ab7c Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 Feb 2015 13:34:45 +0100 Subject: [PATCH] Changed: Minor changes --- code/ryzom/client/src/init.cpp | 3 +-- code/ryzom/client/src/login_patch.cpp | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/code/ryzom/client/src/init.cpp b/code/ryzom/client/src/init.cpp index 1644f7e2d..6958fe790 100644 --- a/code/ryzom/client/src/init.cpp +++ b/code/ryzom/client/src/init.cpp @@ -556,10 +556,9 @@ void checkDriverDepth () static std::string replaceApplicationDirToken(const std::string &dir) { - #ifdef NL_OS_MAC // if client_default.cfg is not in current directory, and it's not an absolute path, use application default directory - if (!CFile::isExists("client_default.cfg") && dir.size()>0 && dir[0]!='/') + if (!CFile::isExists("client_default.cfg") && !dir.empty() && dir[0]!='/') { return getAppBundlePath() + "/Contents/Resources/" + dir; } diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index e98cd1e32..da94f37d6 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -3398,6 +3398,7 @@ bool CPatchManager::extract(const std::string& patchPath, ok = true; } } + if (!ok) { // nothing to extract @@ -3407,15 +3408,21 @@ bool CPatchManager::extract(const std::string& patchPath, // extract uint nblab = 0; pPM->deleteFile(updateBatchFilename, false, false); + FILE *fp = fopen (updateBatchFilename.c_str(), "wt"); + if (fp == 0) { 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); } + +#ifdef NL_OS_WINDOWS fprintf(fp, "@echo off\n"); fprintf(fp, "ping 127.0.0.1 -n 7 -w 1000 > nul\n"); // wait - +#else + // TODO: for Linux and OS X +#endif // Unpack files with category ExtractPath non empty for (uint32 j = 0; j < sourceFilename.size(); ++j) @@ -3442,21 +3449,32 @@ bool CPatchManager::extract(const std::string& patchPath, string DstPath = CPath::standardizeDosPath(extractPath[j]); string DstName = DstPath + vFilenames[fff]; NLMISC::CFile::createDirectoryTree(extractPath[j]); - // this file must be moved + // this file must be moved +#ifdef NL_OS_WINDOWS fprintf(fp, ":loop%u\n", nblab); fprintf(fp, "attrib -r -a -s -h %s\n", DstName.c_str()); fprintf(fp, "del %s\n", DstName.c_str()); fprintf(fp, "if exist %s goto loop%u\n", DstName.c_str(), nblab); fprintf(fp, "move %s %s\n", SrcName.c_str(), DstPath.c_str()); +#else + // TODO: for Linux and OS X +#endif + nblab++; + } } } } +#ifdef NL_OS_WINDOWS fprintf(fp, "start %s %%1 %%2 %%3\n", execName.c_str()); +#else + // TODO: for Linux and OS X +#endif + fclose(fp); if (stopFun)