diff options
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 3 | ||||
-rw-r--r-- | Source/CPack/cmCPackDragNDropGenerator.cxx | 3 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 5 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 6 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 9 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 4 | ||||
-rw-r--r-- | Source/cmUseMangledMesaCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 8 |
11 files changed, 18 insertions, 33 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 24d19d99ca..01e3ea4a7e 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -286,8 +286,7 @@ protected: content = cmSystemTools::TrimWhitespace(content); std::string source = this->basePath + "/" + content; std::string destination = this->path + "/" + content; - if (!cmSystemTools::CopyFileIfDifferent(source.data(), - destination.data())) { + if (!cmSystemTools::CopyFileIfDifferent(source, destination)) { this->hasErrors = true; } } diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 80b9ef3b38..013ad8163e 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -210,8 +210,7 @@ int cmCPackDragNDropGenerator::PackageFiles() bool cmCPackDragNDropGenerator::CopyFile(std::ostringstream& source, std::ostringstream& target) { - if (!cmSystemTools::CopyFileIfDifferent(source.str().c_str(), - target.str().c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(source.str(), target.str())) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Error copying " << source.str() << " to " << target.str() << std::endl); diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 4728f69577..90d38fc7d8 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -392,8 +392,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( std::move(inFileRelative)); } /* If it is not a symlink then do a plain copy */ - else if (!(cmSystemTools::CopyFileIfDifferent(inFile.c_str(), - filePath.c_str()) && + else if (!(cmSystemTools::CopyFileIfDifferent(inFile, filePath) && cmSystemTools::CopyFileTime(inFile.c_str(), filePath.c_str()))) { cmCPackLogger(cmCPackLog::LOG_ERROR, @@ -1077,8 +1076,7 @@ int cmCPackGenerator::DoPackage() << (tempPackageFileName ? tempPackageFileName : "(NULL)") << " to " << (packageFileName ? packageFileName : "(NULL)") << std::endl); - if (!cmSystemTools::CopyFileIfDifferent(tempPackageFileName, - packageFileName)) { + if (!cmSystemTools::CopyFileIfDifferent(pkgFileName, tmpPF)) { cmCPackLogger( cmCPackLog::LOG_ERROR, "Problem copying the package: " diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index c2318cd415..0f911c1700 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -3758,8 +3758,7 @@ bool cmFileCommand::HandleCreateLinkCommand( // Check if copy-on-error is enabled in the arguments. if (!completed && copyOnErrorArg.IsEnabled()) { - completed = - cmSystemTools::cmCopyFile(fileName.c_str(), newFileName.c_str()); + completed = cmSystemTools::cmCopyFile(fileName, newFileName); if (!completed) { result = "Copy failed: " + cmSystemTools::GetLastSystemError(); } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index e3dd2f987c..77be592e82 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -262,9 +262,8 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() // purposes but newer versions distributed with CMake will replace // older versions in user directories. int res; - if (!cmSystemTools::FileTimeCompare(src.c_str(), dst.c_str(), &res) || - res > 0) { - if (!cmSystemTools::CopyFileAlways(src.c_str(), dst.c_str())) { + if (!cmSystemTools::FileTimeCompare(src, dst, &res) || res > 0) { + if (!cmSystemTools::CopyFileAlways(src, dst)) { std::ostringstream oss; oss << "Could not copy from: " << src << std::endl; oss << " to: " << dst << std::endl; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 3ae8034754..ab139c0f1e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3749,8 +3749,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, } if (copyonly) { - if (!cmSystemTools::CopyFileIfDifferent(sinfile.c_str(), - soutfile.c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(sinfile, soutfile)) { return 0; } } else { @@ -3801,8 +3800,7 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, // close the files before attempting to copy fin.close(); fout.close(); - if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(), - soutfile.c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(tempOutputFile, soutfile)) { res = 0; } else { cmSystemTools::SetPermissions(soutfile, perm); diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index f7de3aa71e..9c4afec827 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -940,17 +940,12 @@ std::string cmSystemTools::FileExistsInParentDirectories(const char* fname, return ""; } -bool cmSystemTools::cmCopyFile(const char* source, const char* destination) +bool cmSystemTools::cmCopyFile(const std::string& source, + const std::string& destination) { return Superclass::CopyFileAlways(source, destination); } -bool cmSystemTools::CopyFileIfDifferent(const char* source, - const char* destination) -{ - return Superclass::CopyFileIfDifferent(source, destination); -} - #ifdef _WIN32 cmSystemTools::WindowsFileRetry cmSystemTools::GetWindowsFileRetry() { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index b1d57512da..98ada60850 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -179,8 +179,8 @@ public: std::vector<std::string>& files, int type = 0); ///! Copy a file. - static bool cmCopyFile(const char* source, const char* destination); - static bool CopyFileIfDifferent(const char* source, const char* destination); + static bool cmCopyFile(const std::string& source, + const std::string& destination); /** Rename a file or directory within a single disk volume (atomic if possible). */ diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 01ef5cbea4..9648b21d8f 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -100,6 +100,6 @@ void cmUseMangledMesaCommand::CopyAndFullPathMesaHeader(const char* source, // close the files before attempting to copy fin.close(); fout.close(); - cmSystemTools::CopyFileIfDifferent(tempOutputFile.c_str(), outFile.c_str()); + cmSystemTools::CopyFileIfDifferent(tempOutputFile, outFile); cmSystemTools::RemoveFile(tempOutputFile); } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 70316f10bd..b03ffdb298 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2358,7 +2358,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args) outFile += "/CMakeLists.txt"; // Copy file - if (!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str())) { + if (!cmSystemTools::cmCopyFile(inFile, outFile)) { std::cerr << "Error copying file \"" << inFile << "\" to \"" << outFile << "\".\n"; return 1; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 2a3aedd647..d20c5d23a3 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -482,8 +482,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // If error occurs we want to continue copying next files. bool return_value = false; for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::cmCopyFile(args[cc].c_str(), - args.back().c_str())) { + if (!cmSystemTools::cmCopyFile(args[cc], args.back())) { std::cerr << "Error copying file \"" << args[cc] << "\" to \"" << args.back() << "\".\n"; return_value = true; @@ -505,8 +504,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) // If error occurs we want to continue copying next files. bool return_value = false; for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) { - if (!cmSystemTools::CopyFileIfDifferent(args[cc].c_str(), - args.back().c_str())) { + if (!cmSystemTools::CopyFileIfDifferent(args[cc], args.back())) { std::cerr << "Error copying file (if different) from \"" << args[cc] << "\" to \"" << args.back() << "\".\n"; return_value = true; @@ -1304,7 +1302,7 @@ bool cmcmd::SymlinkInternal(std::string const& file, std::string const& link) cmSystemTools::RemoveFile(link); } #if defined(_WIN32) && !defined(__CYGWIN__) - return cmSystemTools::CopyFileAlways(file.c_str(), link.c_str()); + return cmSystemTools::CopyFileAlways(file, link); #else std::string linktext = cmSystemTools::GetFilenameName(file); return cmSystemTools::CreateSymlink(linktext, link); |