diff --git a/code/nel/include/nel/misc/path.h b/code/nel/include/nel/misc/path.h index 383a0553c..ff7711b06 100644 --- a/code/nel/include/nel/misc/path.h +++ b/code/nel/include/nel/misc/path.h @@ -701,7 +701,7 @@ struct CFile /** Move a file * 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 * \return true if success diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index a1ec1971e..dbe947839 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -579,7 +579,7 @@ namespace NLGUI string finalUrl; 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)) { for(uint i = 0; i < it->imgs.size(); i++) @@ -591,7 +591,7 @@ namespace NLGUI } else { - CFile::moveFile(it->dest.c_str(), tmpfile.c_str()); + CFile::moveFile(it->dest, tmpfile); //if (lookupLocalFile (finalUrl, file.c_str(), false)) { CLuaManager::getInstance().executeLuaScript( it->luaScript, true ); diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 02434e66a..739e807c8 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -356,7 +356,7 @@ namespace NLGUI string backup = nextFileName+".backup"; if (CFile::fileExists(backup)) CFile::deleteFile(backup); - CFile::moveFile(backup.c_str(), nextFileName.c_str()); + CFile::moveFile(backup, nextFileName); } return false; } diff --git a/code/nel/src/misc/file.cpp b/code/nel/src/misc/file.cpp index 842d9ea51..e5c0736f4 100644 --- a/code/nel/src/misc/file.cpp +++ b/code/nel/src/misc/file.cpp @@ -627,7 +627,7 @@ void COFile::internalClose(bool success) if (CFile::fileExists(_FileName)) CFile::deleteFile (_FileName); - if (CFile::moveFile (_FileName.c_str(), _TempFileName.c_str())) + if (CFile::moveFile(_FileName, _TempFileName)) break; nlSleep (0); } diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index 248116f20..de36efa56 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -2451,7 +2451,7 @@ bool CFile::thoroughFileCompare(const std::string &fileName0, const std::string 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); } diff --git a/code/nel/tools/3d/panoply_maker/panoply_maker.cpp b/code/nel/tools/3d/panoply_maker/panoply_maker.cpp index af0c4b731..9a434d438 100644 --- a/code/nel/tools/3d/panoply_maker/panoply_maker.cpp +++ b/code/nel/tools/3d/panoply_maker/panoply_maker.cpp @@ -563,7 +563,7 @@ static bool CheckIfNeedRebuildColoredVersionForOneBitmap(const CBuildInfo &bi, c return true; // 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()); return true; @@ -595,7 +595,7 @@ static bool CheckIfNeedRebuildColoredVersionForOneBitmap(const CBuildInfo &bi, c // get version that is in the cache 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()); return true; diff --git a/code/nel/tools/nel_unit_test/ut_misc_file.h b/code/nel/tools/nel_unit_test/ut_misc_file.h index bf15267f0..34de2d569 100644 --- a/code/nel/tools/nel_unit_test/ut_misc_file.h +++ b/code/nel/tools/nel_unit_test/ut_misc_file.h @@ -127,7 +127,7 @@ private: fclose(fp); fp = NULL; - NLMISC::CFile::moveFile(_DstFile.c_str(), _SrcFile.c_str()); + NLMISC::CFile::moveFile(_DstFile, _SrcFile); // verify the resulting file fp = fopen(_SrcFile.c_str(), "rb"); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index b662468ce..fbaac2c86 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1744,7 +1744,7 @@ bool CInterfaceManager::loadConfig (const string &filename) string sFileNameBackup = sFileName+"backup"; if (CFile::fileExists(sFileNameBackup)) CFile::deleteFile(sFileNameBackup); - CFile::moveFile(sFileNameBackup.c_str(), sFileName.c_str()); + CFile::moveFile(sFileNameBackup, sFileName); nlwarning("Config loading failed : restore default"); vector v; if (!ClientCfg.R2EDEnabled) diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index c4a0b8076..42b9a530d 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -854,7 +854,7 @@ void CPatchManager::createBatchFile(CProductDescriptionForClient &descFile, bool else { deleteFile(DstName); - CFile::moveFile(DstName.c_str(), SrcName.c_str()); + CFile::moveFile(DstName, SrcName); } nblab++; @@ -1128,7 +1128,7 @@ void CPatchManager::renameFile (const string &src, const string &dst) ucstring s = CI18N::get("uiRenameFile") + " " + NLMISC::CFile::getFilename(src); 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) + ")"; setState(true, s); @@ -3677,7 +3677,7 @@ void CDownloadThread::run() try { 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); } diff --git a/code/ryzom/client/src/r2/editor.cpp b/code/ryzom/client/src/r2/editor.cpp index dae1a5fb8..f3a949fcd 100644 --- a/code/ryzom/client/src/r2/editor.cpp +++ b/code/ryzom/client/src/r2/editor.cpp @@ -4734,7 +4734,7 @@ void CEditor::autoSave() { CFile::deleteFile(next); } - CFile::moveFile(next.c_str(), current.c_str()); + CFile::moveFile(next, current); } } diff --git a/code/ryzom/server/src/backup_service/backup_file_access.cpp b/code/ryzom/server/src/backup_service/backup_file_access.cpp index d039a147d..7663424e4 100644 --- a/code/ryzom/server/src/backup_service/backup_file_access.cpp +++ b/code/ryzom/server/src/backup_service/backup_file_access.cpp @@ -478,7 +478,7 @@ IFileAccess::TReturnCode CDeleteFile::execute(CFileAccessManager& manager) } 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 (...) { diff --git a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp index 8ca025870..e6d4d3d8c 100644 --- a/code/ryzom/server/src/entities_game_service/entities_game_service.cpp +++ b/code/ryzom/server/src/entities_game_service/entities_game_service.cpp @@ -3244,8 +3244,8 @@ NLMISC_COMMAND(moveCharAndOfflineCmdToHashTable, "Move all character and offline CFile::createDirectory(PlayerManager.getCharacterPath(userId, false)); // move the file CFile::moveFile( - (PlayerManager.getCharacterPath(userId, false)+CFile::getFilename(allChars[i])).c_str(), - allChars[i].c_str() + PlayerManager.getCharacterPath(userId, false)+CFile::getFilename(allChars[i]), + allChars[i] ); } } @@ -3271,8 +3271,8 @@ NLMISC_COMMAND(moveCharAndOfflineCmdToHashTable, "Move all character and offline CFile::createDirectory(PlayerManager.getOfflineCommandPath(userId, false)); // move the file CFile::moveFile( - (PlayerManager.getOfflineCommandPath(userId, false)+CFile::getFilename(allCommands[i])).c_str(), - allCommands[i].c_str() + PlayerManager.getOfflineCommandPath(userId, false)+CFile::getFilename(allCommands[i]), + allCommands[i] ); } } diff --git a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp index 10544a40b..03efc8291 100644 --- a/code/ryzom/server/src/entities_game_service/player_manager/player.cpp +++ b/code/ryzom/server/src/entities_game_service/player_manager/player.cpp @@ -127,7 +127,7 @@ void CPlayer::checkCrashMarker() wipeAndRestore(NLMISC::toString("%s/account_%u_%d_pdr.bin", PlayerManager.getCharacterPath(userId, false).c_str(), userId, charId)); // 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 // if (CFile::isExists(fileName+".last_good")) @@ -166,9 +166,9 @@ bool wipeAndRestore(const std::string &fileName) return false; } // 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 //if (CFile::isExists(fileName+".last_good")) @@ -811,13 +811,13 @@ void CPlayer::loadAllCharacters() { nlwarning("Failed to load '%s': %s", serialBinFileName.c_str(), e.what()); string newfn = serialBinFileName+".wiped"; - CFile::moveFile(newfn.c_str(), serialBinFileName.c_str()); + CFile::moveFile(newfn, serialBinFileName); } catch(...) { nlwarning("Failed to load '%s': low level exception", serialBinFileName.c_str()); string newfn = serialBinFileName+".wiped"; - CFile::moveFile(newfn.c_str(), serialBinFileName.c_str()); + CFile::moveFile(newfn, serialBinFileName); } } break; @@ -910,13 +910,13 @@ void CPlayer::loadAllCharacters() { nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); } catch(...) { nlwarning("Failed to load '%s': low level exception", fileName.c_str()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); } } else @@ -937,13 +937,13 @@ void CPlayer::loadAllCharacters() { nlwarning("Failed to load '%s': %s", fileName.c_str(), e.what()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); } catch(...) { nlwarning("Failed to load '%s': low level exception", fileName.c_str()); 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()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); continue; } catch(...) { nlwarning("Failed to load '%s': low level exception", fileName.c_str()); string newfn = fileName+".wiped"; - CFile::moveFile(newfn.c_str(), fileName.c_str()); + CFile::moveFile(newfn, fileName); continue; } diff --git a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp index dcd402abb..ee7669e19 100644 --- a/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp +++ b/code/ryzom/server/src/general_utilities_service/rr_repository_reciever.cpp @@ -477,7 +477,7 @@ void CRepositoryReceiver::fileEnd(NLNET::IModuleProxy *sender, const std::string // rename the temp file // 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); // setup the index entry for this file and force an index file write diff --git a/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp b/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp index 90f771ce1..694fea375 100644 --- a/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp +++ b/code/ryzom/server/src/general_utilities_service/saves_shard_saves.cpp @@ -318,7 +318,7 @@ namespace SAVES // do the moving 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 if (CFile::fileExists(_Path+srcPath) && !CFile::fileExists(_Path+dstPath)) diff --git a/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp b/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp index 0866aeb79..bac02ae51 100644 --- a/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp +++ b/code/ryzom/server/src/general_utilities_service/spa_server_patch_applier.cpp @@ -138,7 +138,7 @@ bool finalisePatch(const NLMISC::CSString& installDir,const NLMISC::CSString& fi // rename the final patched file 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) if (NLMISC::CFile::fileExists(oldFile)) diff --git a/code/ryzom/server/src/log_analyser_service/commands.cpp b/code/ryzom/server/src/log_analyser_service/commands.cpp index 0c1a1655b..1b70ae4e2 100644 --- a/code/ryzom/server/src/log_analyser_service/commands.cpp +++ b/code/ryzom/server/src/log_analyser_service/commands.cpp @@ -98,7 +98,7 @@ public: // rename the created file... 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); - 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); } diff --git a/code/ryzom/server/src/logger_service/log_storage.h b/code/ryzom/server/src/logger_service/log_storage.h index 56d4e5c1f..82b949310 100644 --- a/code/ryzom/server/src/logger_service/log_storage.h +++ b/code/ryzom/server/src/logger_service/log_storage.h @@ -246,7 +246,7 @@ public: of.serial(*this); } // rename the 'tmp" into finale output file - NLMISC::CFile::moveFile(fileName.c_str(), (fileName+".tmp").c_str()); + NLMISC::CFile::moveFile(fileName, fileName+".tmp"); } diff --git a/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp b/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp index f902251e9..79e2008de 100644 --- a/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp +++ b/code/ryzom/server/src/mail_forum_service/mail_forum_service.cpp @@ -274,7 +274,7 @@ void CMailForumService::changeUserName(uint32 shardid, const string& oldName, co uint i; for (i=0; i _State.EndTimestamp) { - CFile::moveFile((files[i]+".disabled").c_str(), files[i].c_str()); + CFile::moveFile(files[i]+".disabled", files[i]); continue; } diff --git a/code/ryzom/tools/patch_gen/patch_gen_common.cpp b/code/ryzom/tools/patch_gen/patch_gen_common.cpp index 2437c068e..57f30b5fe 100644 --- a/code/ryzom/tools/patch_gen/patch_gen_common.cpp +++ b/code/ryzom/tools/patch_gen/patch_gen_common.cpp @@ -369,7 +369,7 @@ void CPackageDescription::generatePatches(CBNPFileSet& packageIndex) const // process cannot terminate) GenerateLZMA(bnpFileName, lzmaFile+".tmp"); // 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 diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 30054ffbd..9198196c7 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -408,7 +408,7 @@ bool mergeStringDiff(vector &strings, const string &language, const if (archiveDiff) { // 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; CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); 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); @@ -909,7 +909,7 @@ bool mergePhraseDiff(vector &phrases, const string &language, bool only if (archiveDiff) { // 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; CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); 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); @@ -1334,7 +1334,7 @@ int mergeClauseDiff(int argc, char *argv[]) ucstring old; CI18N::readTextFile(filename, old, false, true, false, CI18N::LINE_FMT_CRLF); 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); @@ -1449,7 +1449,7 @@ bool mergeWorksheetDiff(const std::string filename, TWorksheet &sheet, bool only if (archiveDiff) { // 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]); } } diff --git a/code/studio/src/plugins/bnp_manager/bnp_file.cpp b/code/studio/src/plugins/bnp_manager/bnp_file.cpp index 8cae1164b..675baa04f 100644 --- a/code/studio/src/plugins/bnp_manager/bnp_file.cpp +++ b/code/studio/src/plugins/bnp_manager/bnp_file.cpp @@ -245,7 +245,7 @@ void BNPFileHandle::addFiles( const vector &filePathes) if (CFile::fileExists( m_openedBNPFile )) CFile::deleteFile( m_openedBNPFile ); string src = m_openedBNPFile + ".tmp"; - CFile::moveFile( m_openedBNPFile.c_str(), src.c_str() ); + CFile::moveFile(m_openedBNPFile, src); } // *************************************************************************** void BNPFileHandle::deleteFiles( const vector& fileNames) @@ -281,7 +281,7 @@ void BNPFileHandle::deleteFiles( const vector& fileNames) CFile::deleteFile( m_openedBNPFile ); 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)