mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-23 01:18:46 +00:00
Fixed: Homogenize CFile::moveFile with other methods (use std::string instead of const char*)
--HG-- branch : develop
This commit is contained in:
parent
3baeced8c6
commit
fc951a24ce
26 changed files with 51 additions and 51 deletions
|
@ -701,7 +701,7 @@ struct CFile
|
||||||
/** Move a file
|
/** Move a file
|
||||||
* NB this keeps file attributes
|
* NB this keeps file attributes
|
||||||
*/
|
*/
|
||||||
static bool moveFile(const char *dest, const char *src);
|
static bool moveFile(const std::string &dest, const std::string &src);
|
||||||
|
|
||||||
/** Create a directory
|
/** Create a directory
|
||||||
* \return true if success
|
* \return true if success
|
||||||
|
|
|
@ -579,7 +579,7 @@ namespace NLGUI
|
||||||
string finalUrl;
|
string finalUrl;
|
||||||
if (it->type == ImgType)
|
if (it->type == ImgType)
|
||||||
{
|
{
|
||||||
CFile::moveFile(it->dest.c_str(), tmpfile.c_str());
|
CFile::moveFile(it->dest, tmpfile);
|
||||||
//if (lookupLocalFile (finalUrl, file.c_str(), false))
|
//if (lookupLocalFile (finalUrl, file.c_str(), false))
|
||||||
{
|
{
|
||||||
for(uint i = 0; i < it->imgs.size(); i++)
|
for(uint i = 0; i < it->imgs.size(); i++)
|
||||||
|
@ -591,7 +591,7 @@ namespace NLGUI
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CFile::moveFile(it->dest.c_str(), tmpfile.c_str());
|
CFile::moveFile(it->dest, tmpfile);
|
||||||
//if (lookupLocalFile (finalUrl, file.c_str(), false))
|
//if (lookupLocalFile (finalUrl, file.c_str(), false))
|
||||||
{
|
{
|
||||||
CLuaManager::getInstance().executeLuaScript( it->luaScript, true );
|
CLuaManager::getInstance().executeLuaScript( it->luaScript, true );
|
||||||
|
|
|
@ -356,7 +356,7 @@ namespace NLGUI
|
||||||
string backup = nextFileName+".backup";
|
string backup = nextFileName+".backup";
|
||||||
if (CFile::fileExists(backup))
|
if (CFile::fileExists(backup))
|
||||||
CFile::deleteFile(backup);
|
CFile::deleteFile(backup);
|
||||||
CFile::moveFile(backup.c_str(), nextFileName.c_str());
|
CFile::moveFile(backup, nextFileName);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -627,7 +627,7 @@ void COFile::internalClose(bool success)
|
||||||
if (CFile::fileExists(_FileName))
|
if (CFile::fileExists(_FileName))
|
||||||
CFile::deleteFile (_FileName);
|
CFile::deleteFile (_FileName);
|
||||||
|
|
||||||
if (CFile::moveFile (_FileName.c_str(), _TempFileName.c_str()))
|
if (CFile::moveFile(_FileName, _TempFileName))
|
||||||
break;
|
break;
|
||||||
nlSleep (0);
|
nlSleep (0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2451,7 +2451,7 @@ bool CFile::thoroughFileCompare(const std::string &fileName0, const std::string
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CFile::moveFile(const char *dest,const char *src)
|
bool CFile::moveFile(const std::string &dest, const std::string &src)
|
||||||
{
|
{
|
||||||
return CopyMoveFile(dest, src, false);
|
return CopyMoveFile(dest, src, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -563,7 +563,7 @@ static bool CheckIfNeedRebuildColoredVersionForOneBitmap(const CBuildInfo &bi, c
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// ok, can move the cache
|
// ok, can move the cache
|
||||||
if (!NLMISC::CFile::moveFile(outputHLSInfo.c_str(), cacheHLSInfo.c_str()))
|
if (!NLMISC::CFile::moveFile(outputHLSInfo, cacheHLSInfo))
|
||||||
{
|
{
|
||||||
nlwarning(("Couldn't move " + cacheHLSInfo + " to " + outputHLSInfo).c_str());
|
nlwarning(("Couldn't move " + cacheHLSInfo + " to " + outputHLSInfo).c_str());
|
||||||
return true;
|
return true;
|
||||||
|
@ -595,7 +595,7 @@ static bool CheckIfNeedRebuildColoredVersionForOneBitmap(const CBuildInfo &bi, c
|
||||||
|
|
||||||
// get version that is in the cache
|
// get version that is in the cache
|
||||||
std::string cacheDest = bi.OutputPath + outputFileName + bi.OutputFormat;
|
std::string cacheDest = bi.OutputPath + outputFileName + bi.OutputFormat;
|
||||||
if (!NLMISC::CFile::moveFile(cacheDest.c_str(), searchName.c_str()))
|
if (!NLMISC::CFile::moveFile(cacheDest, searchName))
|
||||||
{
|
{
|
||||||
nlwarning(("Couldn't move " + searchName + " to " + cacheDest).c_str());
|
nlwarning(("Couldn't move " + searchName + " to " + cacheDest).c_str());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -127,7 +127,7 @@ private:
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
|
||||||
NLMISC::CFile::moveFile(_DstFile.c_str(), _SrcFile.c_str());
|
NLMISC::CFile::moveFile(_DstFile, _SrcFile);
|
||||||
|
|
||||||
// verify the resulting file
|
// verify the resulting file
|
||||||
fp = fopen(_SrcFile.c_str(), "rb");
|
fp = fopen(_SrcFile.c_str(), "rb");
|
||||||
|
|
|
@ -1744,7 +1744,7 @@ bool CInterfaceManager::loadConfig (const string &filename)
|
||||||
string sFileNameBackup = sFileName+"backup";
|
string sFileNameBackup = sFileName+"backup";
|
||||||
if (CFile::fileExists(sFileNameBackup))
|
if (CFile::fileExists(sFileNameBackup))
|
||||||
CFile::deleteFile(sFileNameBackup);
|
CFile::deleteFile(sFileNameBackup);
|
||||||
CFile::moveFile(sFileNameBackup.c_str(), sFileName.c_str());
|
CFile::moveFile(sFileNameBackup, sFileName);
|
||||||
nlwarning("Config loading failed : restore default");
|
nlwarning("Config loading failed : restore default");
|
||||||
vector<string> v;
|
vector<string> v;
|
||||||
if (!ClientCfg.R2EDEnabled)
|
if (!ClientCfg.R2EDEnabled)
|
||||||
|
|
|
@ -854,7 +854,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
deleteFile(DstName);
|
deleteFile(DstName);
|
||||||
CFile::moveFile(DstName.c_str(), SrcName.c_str());
|
CFile::moveFile(DstName, SrcName);
|
||||||
}
|
}
|
||||||
|
|
||||||
nblab++;
|
nblab++;
|
||||||
|
@ -1128,7 +1128,7 @@ void CPatchManager::renameFile (const string &src, const string &dst)
|
||||||
ucstring s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src);
|
ucstring s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src);
|
||||||
setState(true, s);
|
setState(true, s);
|
||||||
|
|
||||||
if (!NLMISC::CFile::moveFile(dst.c_str(), src.c_str()))
|
if (!NLMISC::CFile::moveFile(dst, src))
|
||||||
{
|
{
|
||||||
s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")";
|
s = CI18N::get("uiRenameErr") + " " + src + " -> " + dst + " (" + toString(errno) + "," + strerror(errno) + ")";
|
||||||
setState(true, s);
|
setState(true, s);
|
||||||
|
@ -3677,7 +3677,7 @@ void CDownloadThread::run()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pPM->getServerFile(patchName, false, tmpFile);
|
pPM->getServerFile(patchName, false, tmpFile);
|
||||||
NLMISC::CFile::moveFile(finalFile.c_str(), tmpFile.c_str());
|
NLMISC::CFile::moveFile(finalFile, tmpFile);
|
||||||
|
|
||||||
pPM->applyDate(finalFile, _Entries[first].Timestamp);
|
pPM->applyDate(finalFile, _Entries[first].Timestamp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4734,7 +4734,7 @@ void CEditor::autoSave()
|
||||||
{
|
{
|
||||||
CFile::deleteFile(next);
|
CFile::deleteFile(next);
|
||||||
}
|
}
|
||||||
CFile::moveFile(next.c_str(), current.c_str());
|
CFile::moveFile(next, current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,7 @@ IFileAccess::TReturnCode CDeleteFile::execute(CFileAccessManager& manager)
|
||||||
}
|
}
|
||||||
while (i <= 10000 && NLMISC::CFile::fileExists(backup));
|
while (i <= 10000 && NLMISC::CFile::fileExists(backup));
|
||||||
|
|
||||||
fileBackuped = (i <= 10000 && NLMISC::CFile::moveFile(backup.c_str(), (getBackupFileName(Filename)).c_str()));
|
fileBackuped = (i <= 10000 && NLMISC::CFile::moveFile(backup, getBackupFileName(Filename)));
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3244,8 +3244,8 @@ NLMISC_COMMAND(moveCharAndOfflineCmdToHashTable, "Move all character and offline
|
||||||
CFile::createDirectory(PlayerManager.getCharacterPath(userId, false));
|
CFile::createDirectory(PlayerManager.getCharacterPath(userId, false));
|
||||||
// move the file
|
// move the file
|
||||||
CFile::moveFile(
|
CFile::moveFile(
|
||||||
(PlayerManager.getCharacterPath(userId, false)+CFile::getFilename(allChars[i])).c_str(),
|
PlayerManager.getCharacterPath(userId, false)+CFile::getFilename(allChars[i]),
|
||||||
allChars[i].c_str()
|
allChars[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3271,8 +3271,8 @@ NLMISC_COMMAND(moveCharAndOfflineCmdToHashTable, "Move all character and offline
|
||||||
CFile::createDirectory(PlayerManager.getOfflineCommandPath(userId, false));
|
CFile::createDirectory(PlayerManager.getOfflineCommandPath(userId, false));
|
||||||
// move the file
|
// move the file
|
||||||
CFile::moveFile(
|
CFile::moveFile(
|
||||||
(PlayerManager.getOfflineCommandPath(userId, false)+CFile::getFilename(allCommands[i])).c_str(),
|
PlayerManager.getOfflineCommandPath(userId, false)+CFile::getFilename(allCommands[i]),
|
||||||
allCommands[i].c_str()
|
allCommands[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ void CPlayer::checkCrashMarker()
|
||||||
wipeAndRestore(NLMISC::toString("%s/account_%u_%d_pdr.bin", PlayerManager.getCharacterPath(userId, false).c_str(), userId, charId));
|
wipeAndRestore(NLMISC::toString("%s/account_%u_%d_pdr.bin", PlayerManager.getCharacterPath(userId, false).c_str(), userId, charId));
|
||||||
|
|
||||||
// string fileName = makeCharacterFileName(lastBad[0], lastBad[1]);
|
// string fileName = makeCharacterFileName(lastBad[0], lastBad[1]);
|
||||||
// CFile::moveFile((fileName+".wiped").c_str(), fileName.c_str());
|
// CFile::moveFile(fileName+".wiped", fileName);
|
||||||
//
|
//
|
||||||
// // try to restore a backup
|
// // try to restore a backup
|
||||||
// if (CFile::isExists(fileName+".last_good"))
|
// if (CFile::isExists(fileName+".last_good"))
|
||||||
|
@ -166,9 +166,9 @@ bool wipeAndRestore(const std::string &fileName)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// move the last wiped file
|
// move the last wiped file
|
||||||
CFile::moveFile(incFn.c_str(), newfn.c_str());
|
CFile::moveFile(incFn, newfn);
|
||||||
}
|
}
|
||||||
CFile::moveFile(newfn.c_str(), fileName.c_str());
|
CFile::moveFile(newfn, fileName);
|
||||||
|
|
||||||
// // try to restore a backup
|
// // try to restore a backup
|
||||||
//if (CFile::isExists(fileName+".last_good"))
|
//if (CFile::isExists(fileName+".last_good"))
|
||||||
|
@ -811,13 +811,13 @@ void CPlayer::loadAllCharacters()
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': %s", serialBinFileName.c_str(), e.what());
|
nlwarning("Failed to load '%s': %s", serialBinFileName.c_str(), e.what());
|
||||||
string newfn = serialBinFileName+".wiped";
|
string newfn = serialBinFileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), serialBinFileName.c_str());
|
CFile::moveFile(newfn, serialBinFileName);
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': low level exception", serialBinFileName.c_str());
|
nlwarning("Failed to load '%s': low level exception", serialBinFileName.c_str());
|
||||||
string newfn = serialBinFileName+".wiped";
|
string newfn = serialBinFileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), serialBinFileName.c_str());
|
CFile::moveFile(newfn, serialBinFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -910,13 +910,13 @@ void CPlayer::loadAllCharacters()
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what());
|
nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what());
|
||||||
string newfn = fileName+".wiped";
|
string newfn = fileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), fileName.c_str());
|
CFile::moveFile(newfn, fileName);
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': low level exception", fileName.c_str());
|
nlwarning("Failed to load '%s': low level exception", fileName.c_str());
|
||||||
string newfn = fileName+".wiped";
|
string newfn = fileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), fileName.c_str());
|
CFile::moveFile(newfn, fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -937,13 +937,13 @@ void CPlayer::loadAllCharacters()
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what());
|
nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what());
|
||||||
string newfn = fileName+".wiped";
|
string newfn = fileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), fileName.c_str());
|
CFile::moveFile(newfn, fileName);
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': low level exception", fileName.c_str());
|
nlwarning("Failed to load '%s': low level exception", fileName.c_str());
|
||||||
string newfn = fileName+".wiped";
|
string newfn = fileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), fileName.c_str());
|
CFile::moveFile(newfn, fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -983,14 +983,14 @@ void CPlayer::loadAllCharactersPdr()
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what());
|
nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what());
|
||||||
string newfn = fileName+".wiped";
|
string newfn = fileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), fileName.c_str());
|
CFile::moveFile(newfn, fileName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
nlwarning("Failed to load '%s': low level exception", fileName.c_str());
|
nlwarning("Failed to load '%s': low level exception", fileName.c_str());
|
||||||
string newfn = fileName+".wiped";
|
string newfn = fileName+".wiped";
|
||||||
CFile::moveFile(newfn.c_str(), fileName.c_str());
|
CFile::moveFile(newfn, fileName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -477,7 +477,7 @@ void CRepositoryReceiver::fileEnd(NLNET::IModuleProxy *sender, const std::string
|
||||||
|
|
||||||
// rename the temp file
|
// rename the temp file
|
||||||
// note that the _receiveBeginFile() method will have removed any file that could be in the way...
|
// note that the _receiveBeginFile() method will have removed any file that could be in the way...
|
||||||
bool renameOk= NLMISC::CFile::moveFile((_TargetDirectory+awaitedFileName).c_str(),rrTempFileName(_TargetDirectory,_EmitterName).c_str());
|
bool renameOk= NLMISC::CFile::moveFile(_TargetDirectory+awaitedFileName, rrTempFileName(_TargetDirectory,_EmitterName));
|
||||||
DROP_IF(!renameOk,"Failed to move tmp file ('"+rrTempFileName(_TargetDirectory,_EmitterName)+"') to : '"+fileNameRec+"'",return);
|
DROP_IF(!renameOk,"Failed to move tmp file ('"+rrTempFileName(_TargetDirectory,_EmitterName)+"') to : '"+fileNameRec+"'",return);
|
||||||
|
|
||||||
// setup the index entry for this file and force an index file write
|
// setup the index entry for this file and force an index file write
|
||||||
|
|
|
@ -318,7 +318,7 @@ namespace SAVES
|
||||||
|
|
||||||
// do the moving
|
// do the moving
|
||||||
nlinfo("Treating request to move file: %s => %s",srcPath.c_str(),dstPath.c_str());
|
nlinfo("Treating request to move file: %s => %s",srcPath.c_str(),dstPath.c_str());
|
||||||
CFile::moveFile((_Path+dstPath).c_str(),(_Path+srcPath).c_str());
|
CFile::moveFile(_Path+dstPath, _Path+srcPath);
|
||||||
|
|
||||||
// make sure the src file no longer exists and that a destination file now exists
|
// make sure the src file no longer exists and that a destination file now exists
|
||||||
if (CFile::fileExists(_Path+srcPath) && !CFile::fileExists(_Path+dstPath))
|
if (CFile::fileExists(_Path+srcPath) && !CFile::fileExists(_Path+dstPath))
|
||||||
|
|
|
@ -138,7 +138,7 @@ bool finalisePatch(const NLMISC::CSString& installDir,const NLMISC::CSString& fi
|
||||||
|
|
||||||
// rename the final patched file
|
// rename the final patched file
|
||||||
nldebug("SPA RENAME: %s => %s",srcFile.c_str(),destFile.c_str());
|
nldebug("SPA RENAME: %s => %s",srcFile.c_str(),destFile.c_str());
|
||||||
NLMISC::CFile::moveFile(destFile.c_str(),srcFile.c_str());
|
NLMISC::CFile::moveFile(destFile, srcFile);
|
||||||
|
|
||||||
// delete the temp file used in patch generation (if there was one)
|
// delete the temp file used in patch generation (if there was one)
|
||||||
if (NLMISC::CFile::fileExists(oldFile))
|
if (NLMISC::CFile::fileExists(oldFile))
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
// rename the created file...
|
// rename the created file...
|
||||||
DROP_IF(!NLMISC::CFile::fileExists(_TmpFileName),"No output file created: "+_TmpFileName,return);
|
DROP_IF(!NLMISC::CFile::fileExists(_TmpFileName),"No output file created: "+_TmpFileName,return);
|
||||||
DROP_IF(NLMISC::CFile::fileExists(_FileName),"Cannot rename output file '"+_TmpFileName+"' because another file is in the way: "+_FileName,return);
|
DROP_IF(NLMISC::CFile::fileExists(_FileName),"Cannot rename output file '"+_TmpFileName+"' because another file is in the way: "+_FileName,return);
|
||||||
NLMISC::CFile::moveFile(_FileName.c_str(),_TmpFileName.c_str());
|
NLMISC::CFile::moveFile(_FileName, _TmpFileName);
|
||||||
DROP_IF(!NLMISC::CFile::fileExists(_FileName),"Failed to create final output file: '"+_FileName+"' from tmp file: '"+_TmpFileName+"'",return);
|
DROP_IF(!NLMISC::CFile::fileExists(_FileName),"Failed to create final output file: '"+_FileName+"' from tmp file: '"+_TmpFileName+"'",return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -246,7 +246,7 @@ public:
|
||||||
of.serial(*this);
|
of.serial(*this);
|
||||||
}
|
}
|
||||||
// rename the 'tmp" into finale output file
|
// rename the 'tmp" into finale output file
|
||||||
NLMISC::CFile::moveFile(fileName.c_str(), (fileName+".tmp").c_str());
|
NLMISC::CFile::moveFile(fileName, fileName+".tmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -274,7 +274,7 @@ void CMailForumService::changeUserName(uint32 shardid, const string& oldName, co
|
||||||
|
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0; i<files.size(); ++i)
|
for (i=0; i<files.size(); ++i)
|
||||||
CFile::moveFile((newdir+CFile::getFilename(files[i])).c_str(), files[i].c_str());
|
CFile::moveFile(newdir+CFile::getFilename(files[i]), files[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ void CMailForumService::removeUser( uint32 shardid, string username )
|
||||||
}
|
}
|
||||||
while (CFile::isExists(userDelDir));
|
while (CFile::isExists(userDelDir));
|
||||||
|
|
||||||
CFile::moveFile(userDelDir.c_str(), userDir.c_str());
|
CFile::moveFile(userDelDir, userDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
|
@ -392,7 +392,7 @@ void CMailForumService::removeGuild( uint32 shardid, string guildname )
|
||||||
}
|
}
|
||||||
while (CFile::isExists(guildDelDir));
|
while (CFile::isExists(guildDelDir));
|
||||||
|
|
||||||
CFile::moveFile(guildDelDir.c_str(), guildDir.c_str());
|
CFile::moveFile(guildDelDir, guildDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -677,7 +677,7 @@ namespace PATCHMAN
|
||||||
}
|
}
|
||||||
|
|
||||||
// write succeeded so rename the tmp file to the correct file name
|
// write succeeded so rename the tmp file to the correct file name
|
||||||
bool ok= NLMISC::CFile::moveFile(fileName.c_str(),tmpFileName.c_str());
|
bool ok= NLMISC::CFile::moveFile(fileName, tmpFileName);
|
||||||
DROP_IF(!ok,"Failed to save file '"+fileName+"' because failed to rename tmp file: '"+tmpFileName+"'",return false);
|
DROP_IF(!ok,"Failed to save file '"+fileName+"' because failed to rename tmp file: '"+tmpFileName+"'",return false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -493,7 +493,7 @@ void CRepositoryReceiver::fileList(NLNET::IModuleProxy *sender, uint32 version,
|
||||||
//
|
//
|
||||||
// // rename the temp file
|
// // rename the temp file
|
||||||
// // note that the _receiveBeginFile() method will have removed any file that could be in the way...
|
// // note that the _receiveBeginFile() method will have removed any file that could be in the way...
|
||||||
// bool renameOk= NLMISC::CFile::moveFile((_TargetDirectories.patchDirectoryName()+awaitedFileName).c_str(),rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName).c_str());
|
// bool renameOk= NLMISC::CFile::moveFile(_TargetDirectories.patchDirectoryName()+awaitedFileName, rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName));
|
||||||
// DROP_IF(!renameOk,"Failed to move tmp file ('"+rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName)+"') to : '"+fileNameRec+"'",return);
|
// DROP_IF(!renameOk,"Failed to move tmp file ('"+rrTempFileName(_TargetDirectories.patchDirectoryName(),_EmitterName)+"') to : '"+fileNameRec+"'",return);
|
||||||
//
|
//
|
||||||
// // If we're all done then we need to set the new version number
|
// // If we're all done then we need to set the new version number
|
||||||
|
|
|
@ -290,7 +290,7 @@ void CServerPatchTerminal::onModuleUpdate()
|
||||||
{
|
{
|
||||||
// move the command file to a tmp file...
|
// move the command file to a tmp file...
|
||||||
CSString tmpFileName= _CommandFileName+"__patchman__spt__.tmp";
|
CSString tmpFileName= _CommandFileName+"__patchman__spt__.tmp";
|
||||||
bool ok= NLMISC::CFile::moveFile(tmpFileName.c_str(),_CommandFileName.c_str());
|
bool ok= NLMISC::CFile::moveFile(tmpFileName,_CommandFileName);
|
||||||
DROP_IF(!ok,"Attempt to move file '"+_CommandFileName+"' to '"+tmpFileName+"' FAILED",return);
|
DROP_IF(!ok,"Attempt to move file '"+_CommandFileName+"' to '"+tmpFileName+"' FAILED",return);
|
||||||
|
|
||||||
// read the tmp file and delete it
|
// read the tmp file and delete it
|
||||||
|
|
|
@ -1409,7 +1409,7 @@ bool CDatabase::isReferenceUpToDate()
|
||||||
{
|
{
|
||||||
if (timestamp > _State.EndTimestamp)
|
if (timestamp > _State.EndTimestamp)
|
||||||
{
|
{
|
||||||
CFile::moveFile((files[i]+".disabled").c_str(), files[i].c_str());
|
CFile::moveFile(files[i]+".disabled", files[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const
|
||||||
// process cannot terminate)
|
// process cannot terminate)
|
||||||
GenerateLZMA(bnpFileName, lzmaFile+".tmp");
|
GenerateLZMA(bnpFileName, lzmaFile+".tmp");
|
||||||
// rename the tmp file
|
// rename the tmp file
|
||||||
CFile::moveFile(lzmaFile.c_str(), (lzmaFile+".tmp").c_str());
|
CFile::moveFile(lzmaFile, lzmaFile+".tmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the lzma file size in the descriptor
|
// store the lzma file size in the descriptor
|
||||||
|
|
|
@ -408,7 +408,7 @@ bool mergeStringDiff(vector<TStringInfo> &strings, const string &language, const
|
||||||
if (archiveDiff)
|
if (archiveDiff)
|
||||||
{
|
{
|
||||||
// move the diff file in the history dir
|
// move the diff file in the history dir
|
||||||
CFile::moveFile((historyDir+CFile::getFilename(diffs[i])).c_str(), diffs[i].c_str());
|
CFile::moveFile(historyDir+CFile::getFilename(diffs[i]), diffs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,7 +801,7 @@ int mergeStringDiff(int argc, char *argv[])
|
||||||
ucstring old;
|
ucstring old;
|
||||||
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF);
|
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF);
|
||||||
if (old != str)
|
if (old != str)
|
||||||
CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str());
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
CI18N::writeTextFile(filename, str);
|
CI18N::writeTextFile(filename, str);
|
||||||
|
@ -909,7 +909,7 @@ bool mergePhraseDiff(vector<TPhrase> &phrases, const string &language, bool only
|
||||||
if (archiveDiff)
|
if (archiveDiff)
|
||||||
{
|
{
|
||||||
// move the diff file in the history dir
|
// move the diff file in the history dir
|
||||||
CFile::moveFile((historyDir+CFile::getFilename(diffs[i])).c_str(), diffs[i].c_str());
|
CFile::moveFile(historyDir+CFile::getFilename(diffs[i]), diffs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1165,7 +1165,7 @@ int mergePhraseDiff(int argc, char *argv[], int version)
|
||||||
ucstring old;
|
ucstring old;
|
||||||
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF);
|
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF);
|
||||||
if (old != str)
|
if (old != str)
|
||||||
CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str());
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
CI18N::writeTextFile(transDir+basename+".txt", str);
|
CI18N::writeTextFile(transDir+basename+".txt", str);
|
||||||
|
@ -1334,7 +1334,7 @@ int mergeClauseDiff(int argc, char *argv[])
|
||||||
ucstring old;
|
ucstring old;
|
||||||
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF);
|
CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF);
|
||||||
if (old != str)
|
if (old != str)
|
||||||
CFile::moveFile((historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename)).c_str(), filename.c_str());
|
CFile::moveFile(historyDir+CFile::getFilenameWithoutExtension(filename)+"_"+diffVersion+"."+CFile::getExtension(filename), filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
CI18N::writeTextFile(filename, str);
|
CI18N::writeTextFile(filename, str);
|
||||||
|
@ -1449,7 +1449,7 @@ bool mergeWorksheetDiff(const std::string filename, TWorksheet &sheet, bool only
|
||||||
if (archiveDiff)
|
if (archiveDiff)
|
||||||
{
|
{
|
||||||
// move the diff file in the history dir
|
// move the diff file in the history dir
|
||||||
CFile::moveFile((historyDir+CFile::getFilename(fileList[i])).c_str(), fileList[i].c_str());
|
CFile::moveFile(historyDir+CFile::getFilename(fileList[i]), fileList[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ void BNPFileHandle::addFiles( const vector<string> &filePathes)
|
||||||
if (CFile::fileExists( m_openedBNPFile ))
|
if (CFile::fileExists( m_openedBNPFile ))
|
||||||
CFile::deleteFile( m_openedBNPFile );
|
CFile::deleteFile( m_openedBNPFile );
|
||||||
string src = m_openedBNPFile + ".tmp";
|
string src = m_openedBNPFile + ".tmp";
|
||||||
CFile::moveFile( m_openedBNPFile.c_str(), src.c_str() );
|
CFile::moveFile(m_openedBNPFile, src);
|
||||||
}
|
}
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void BNPFileHandle::deleteFiles( const vector<string>& fileNames)
|
void BNPFileHandle::deleteFiles( const vector<string>& fileNames)
|
||||||
|
@ -281,7 +281,7 @@ void BNPFileHandle::deleteFiles( const vector<string>& fileNames)
|
||||||
|
|
||||||
CFile::deleteFile( m_openedBNPFile );
|
CFile::deleteFile( m_openedBNPFile );
|
||||||
string src = m_openedBNPFile + ".tmp";
|
string src = m_openedBNPFile + ".tmp";
|
||||||
CFile::moveFile( m_openedBNPFile.c_str(), src.c_str() );
|
CFile::moveFile(m_openedBNPFile, src);
|
||||||
}
|
}
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
void BNPFileHandle::append(const string &destination, const PackedFile &source)
|
void BNPFileHandle::append(const string &destination, const PackedFile &source)
|
||||||
|
|
Loading…
Reference in a new issue