diff --git a/code/nel/include/nel/misc/path.h b/code/nel/include/nel/misc/path.h index 004156750..52088d67b 100644 --- a/code/nel/include/nel/misc/path.h +++ b/code/nel/include/nel/misc/path.h @@ -651,7 +651,7 @@ struct CFile * \param failIfExists If the destination file exists, nothing is done, and it returns false. * \return true if the copy succeeded */ - static bool copyFile(const char *dest, const char *src, bool failIfExists = false, class IProgressCallback *progress = NULL); + static bool copyFile(const std::string &dest, const std::string &src, bool failIfExists = false, class IProgressCallback *progress = NULL); /** Compare 2 files * \return true if both files exist and the files have same timestamp and size diff --git a/code/nel/src/misc/file.cpp b/code/nel/src/misc/file.cpp index 98ede1eb1..515c49014 100644 --- a/code/nel/src/misc/file.cpp +++ b/code/nel/src/misc/file.cpp @@ -588,7 +588,7 @@ bool COFile::open(const std::string &path, bool append, bool text, bool useTempF if (append && useTempFile && CFile::fileExists(_FileName)) { // open fails if can't copy original content - if (!CFile::copyFile(_TempFileName.c_str(), _FileName.c_str())) + if (!CFile::copyFile(_TempFileName, _FileName)) return false; } diff --git a/code/nel/src/misc/path.cpp b/code/nel/src/misc/path.cpp index 301669b75..e30982056 100644 --- a/code/nel/src/misc/path.cpp +++ b/code/nel/src/misc/path.cpp @@ -2099,10 +2099,9 @@ void CFile::checkFileChange (TTime frequency) } } -static bool CopyMoveFile(const char *dest, const char *src, bool copyFile, bool failIfExists = false, IProgressCallback *progress = NULL) +static bool CopyMoveFile(const std::string &dest, const std::string &src, bool copyFile, bool failIfExists = false, IProgressCallback *progress = NULL) { - if (!dest || !src) return false; - if (!strlen(dest) || !strlen(src)) return false; + if (dest.empty() || src.empty()) return false; std::string sdest = CPath::standardizePath(dest,false); std::string ssrc = CPath::standardizePath(src,false); @@ -2199,7 +2198,7 @@ static bool CopyMoveFile(const char *dest, const char *src, bool copyFile, bool return true; } -bool CFile::copyFile(const char *dest, const char *src, bool failIfExists /*=false*/, IProgressCallback *progress) +bool CFile::copyFile(const std::string &dest, const std::string &src, bool failIfExists /*=false*/, IProgressCallback *progress) { return CopyMoveFile(dest, src, true, failIfExists, progress); } diff --git a/code/nel/tools/3d/build_clodtex/main.cpp b/code/nel/tools/3d/build_clodtex/main.cpp index d857af17b..f92a0c703 100644 --- a/code/nel/tools/3d/build_clodtex/main.cpp +++ b/code/nel/tools/3d/build_clodtex/main.cpp @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) // if fail to find a valid filter, just do a copy if(j==LodFilters.size()) { - CFile::copyFile(pathNameOut.c_str(), pathNameIn.c_str()); + CFile::copyFile(pathNameOut, pathNameIn); NLMISC::InfoLog->displayRaw("Processing %s - Copied\n", fileNameIn.c_str()); } } diff --git a/code/nel/tools/3d/crash_log_analyser/main.cpp b/code/nel/tools/3d/crash_log_analyser/main.cpp index 02bb1d206..df4c4e766 100644 --- a/code/nel/tools/3d/crash_log_analyser/main.cpp +++ b/code/nel/tools/3d/crash_log_analyser/main.cpp @@ -126,7 +126,7 @@ void filterRyzomBug(const char *dirSrc, const char *dirDst, uint patchVersionWan CFile::createDirectory(dirDest); // copy near the dmp - CFile::copyFile((dirDest + "/" + fileNoDir).c_str(), fileFullPath.c_str()); + CFile::copyFile(dirDest + "/" + fileNoDir, fileFullPath); // copy all the .dmp in a new dir @@ -136,7 +136,7 @@ void filterRyzomBug(const char *dirSrc, const char *dirDst, uint patchVersionWan for(uint j=0;j& files, NLMISC::CLo { id.Chars[i].Backup = id.Chars[i].File + ".tmp"; CFile::copyFile( - id.Chars[i].Backup.c_str(), - id.Chars[i].File.c_str()); + id.Chars[i].Backup, + id.Chars[i].File); } } @@ -596,8 +596,8 @@ bool loadAndResaveCheckCharacters( const std::vector& files, NLMISC::CLo for (i=0; isecond.size()) { nlinfo("COPY: %s from %s",(_Directories.installDirectoryName()+it->first).c_str(),(_Directories.liveDirectoryName()+it->first).c_str()); - NLMISC::CFile::copyFile((_Directories.installDirectoryName()+it->first).c_str(),(_Directories.liveDirectoryName()+it->first).c_str()); + NLMISC::CFile::copyFile(_Directories.installDirectoryName()+it->first,_Directories.liveDirectoryName()+it->first); untarIfNeeded(_Directories.installDirectoryName()+it->first); continue; } @@ -381,7 +381,7 @@ void CServerPatchApplier::_patchDownFromLive(uint32 liveVersion, uint32 installR if (needBackPatchSet.find(it->first)==needBackPatchSet.end()) { nlinfo("COPY: %s => %s",(_Directories.installDirectoryName()+it->first).c_str(),(_Directories.liveDirectoryName()+it->first).c_str()); - NLMISC::CFile::copyFile((_Directories.installDirectoryName()+it->first).c_str(),(_Directories.liveDirectoryName()+it->first).c_str()); + NLMISC::CFile::copyFile(_Directories.installDirectoryName()+it->first,_Directories.liveDirectoryName()+it->first); continue; } diff --git a/code/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp b/code/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp index bcf0e6814..85ca066e0 100644 --- a/code/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp +++ b/code/ryzom/server/src/patchman_service/spa_server_patch_applier.cpp @@ -827,7 +827,7 @@ void CServerPatchApplier::_requestDownload(const NLMISC::CSString& domainName,co if (fileInfo.Checksum==liveFileInfo.Checksum) { // try copying the file and return if we succeeded (we don't need to send a download request) - bool ok=NLMISC::CFile::copyFile(fileNameInNext.c_str(),fileNameInLive.c_str()); + bool ok=NLMISC::CFile::copyFile(fileNameInNext,fileNameInLive); if (ok) return; } diff --git a/code/ryzom/server/src/patchman_service/spb_server_patch_bridge.cpp b/code/ryzom/server/src/patchman_service/spb_server_patch_bridge.cpp index 075798637..e68548086 100644 --- a/code/ryzom/server/src/patchman_service/spb_server_patch_bridge.cpp +++ b/code/ryzom/server/src/patchman_service/spb_server_patch_bridge.cpp @@ -386,7 +386,7 @@ void CServerPatchBridge::requestFileData(NLNET::IModuleProxy *sender, const NLMI CSString rootDirectory= getRepositoryDirectory()->getRootDirectory(); CSString fullFileName= rootDirectory+fileInfo.FileName; NLMISC::CFile::createDirectoryTree(NLMISC::CFile::getPath(fullFileName)); - bool ok= NLMISC::CFile::copyFile(fullFileName.c_str(),(rootDirectory+itInfo.FileName).c_str()); + bool ok= NLMISC::CFile::copyFile(fullFileName,rootDirectory+itInfo.FileName); WARN_IF(!ok,"Failed to copy file: '"+itInfo.FileName+" to '"+fileInfo.FileName+"'"); // force our repository to update it's info concerning the file that we just copied and rebuild our info vector diff --git a/code/ryzom/server/src/pd_lib/reference_builder.cpp b/code/ryzom/server/src/pd_lib/reference_builder.cpp index e93c85132..749ff5052 100644 --- a/code/ryzom/server/src/pd_lib/reference_builder.cpp +++ b/code/ryzom/server/src/pd_lib/reference_builder.cpp @@ -122,7 +122,7 @@ bool CReferenceBuilder::internalBuild(const std::string& rootRefPath, CTimestamp maxstamp(maxtimestamp); // copy xml description from previous directory to new - if (!CFile::copyFile((next+"description.xml").c_str(), (previous+"description.xml").c_str(), true)) + if (!CFile::copyFile(next+"description.xml", previous+"description.xml", true)) { nlwarning("CReferenceBuilder::build(): failed to copy 'description.xml' from '%s' to '%s'", previous.c_str(), next.c_str()); return false; @@ -151,7 +151,7 @@ bool CReferenceBuilder::internalBuild(const std::string& rootRefPath, string file = CFile::getFilename(files[i]); // copy from old to new directory - if (!CFile::copyFile((next+file).c_str(), (previous+file).c_str(), true)) + if (!CFile::copyFile(next+file, previous+file, true)) { nlwarning("CReferenceBuilder::build(): failed to copy '%s' from '%s' to '%s'", file.c_str(), previous.c_str(), next.c_str()); return false; diff --git a/code/ryzom/server/src/persistant_data_service/pds_database.cpp b/code/ryzom/server/src/persistant_data_service/pds_database.cpp index 36e9c06dd..b61a6ed9b 100644 --- a/code/ryzom/server/src/persistant_data_service/pds_database.cpp +++ b/code/ryzom/server/src/persistant_data_service/pds_database.cpp @@ -1596,7 +1596,7 @@ bool CDatabase::buildDelta(const CTimestamp& starttime, const CTimestamp& endtim std::string statePath = _Reference.getRootPath(); std::string stateName = CDatabaseState::fileName(); if (CFile::fileExists(statePath+stateName) && - !CFile::copyFile((statePath+"previous_"+stateName).c_str(), (statePath+stateName).c_str(), false)) + !CFile::copyFile(statePath+"previous_"+stateName, statePath+stateName, false)) { PDS_WARNING("buildDelta(): failed copy state file to backup previous_state"); } diff --git a/code/ryzom/server/src/server_share/handy_commands.cpp b/code/ryzom/server/src/server_share/handy_commands.cpp index cfaccf836..bcf36ae98 100644 --- a/code/ryzom/server/src/server_share/handy_commands.cpp +++ b/code/ryzom/server/src/server_share/handy_commands.cpp @@ -390,7 +390,7 @@ NLMISC_CATEGORISED_COMMAND(utils,copyFile,"copy a file"," ") if (args.size()!=2) return false; - NLMISC::CFile::copyFile(args[1].c_str(),args[0].c_str()); + NLMISC::CFile::copyFile(args[1],args[0]); return true; } diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index 242a7ed72..bc3b21cb8 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -842,19 +842,19 @@ bool CMissionCompiler::publishFiles(const std::string &serverPathPrim, const std string textFile = CPath::standardizePath(serverPathText) + "phrase_rites_wk.txt"; includeText(textFile, string("#include \"") + src + string("\"\n")); dst = CPath::standardizePath(serverPathText) + src; - NLMISC::CFile::copyFile(dst.c_str(), src.c_str()); + NLMISC::CFile::copyFile(dst, src); // local textFile = CPath::standardizePath(localPathText) + "phrase_rites_wk.txt"; includeText(textFile, string("#include \"") + src + string("\"\n")); dst = CPath::standardizePath(localPathText) + src; - NLMISC::CFile::copyFile(dst.c_str(), src.c_str()); + NLMISC::CFile::copyFile(dst, src); } else { // primitive file : copy to server dst = CPath::standardizePath(serverPathPrim) + string(src, n, src.size()); - NLMISC::CFile::copyFile(dst.c_str(), src.c_str()); + NLMISC::CFile::copyFile(dst, src); } } return true; diff --git a/code/ryzom/tools/patch_gen/patch_gen_common.cpp b/code/ryzom/tools/patch_gen/patch_gen_common.cpp index 83a26c5f9..f4d856be1 100644 --- a/code/ryzom/tools/patch_gen/patch_gen_common.cpp +++ b/code/ryzom/tools/patch_gen/patch_gen_common.cpp @@ -249,7 +249,7 @@ void CPackageDescription::updateIndexFileList(CBNPFileSet& packageIndex) const // if the ref file doesn't exist then create it by copying the original if (NLMISC::CFile::fileExists(_BnpDirectory+fileName) && !NLMISC::CFile::fileExists(_BnpDirectory+refName)) { - NLMISC::CFile::copyFile((_BnpDirectory+refName).c_str(),(_BnpDirectory+fileName).c_str()); + NLMISC::CFile::copyFile(_BnpDirectory+refName,_BnpDirectory+fileName); nlassert(NLMISC::CFile::getFileSize(_BnpDirectory+refName)== NLMISC::CFile::getFileSize(_BnpDirectory+fileName)); } } diff --git a/code/ryzom/tools/translation_tools/main.cpp b/code/ryzom/tools/translation_tools/main.cpp index 58fc8f536..75d0c18b5 100644 --- a/code/ryzom/tools/translation_tools/main.cpp +++ b/code/ryzom/tools/translation_tools/main.cpp @@ -2457,7 +2457,7 @@ int updatePhraseWork() std::string newFile = saveDir + outputResult[firstFile].second; std::string oldFile = outputResult[firstFile].second; CFile::createDirectoryTree(CFile::getPath(newFile)); - if ( CFile::copyFile(newFile.c_str(), oldFile.c_str()) ) + if ( CFile::copyFile(newFile, oldFile) ) { patchWorkFile(updatedPhrases, newFile);