mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-26 16:56:19 +00:00
Changed: Minor changes
This commit is contained in:
parent
491613e7fa
commit
eca33bfb95
2 changed files with 21 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue