diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:20:02 (GMT) |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2018-01-31 15:23:03 (GMT) |
commit | 653b894683abe63233cb8679b34ea39d9017e317 (patch) | |
tree | 200e5066b754d8ddfdc7beb86c4db179aa2e69d0 /Source/CPack/cmCPackGenerator.cxx | |
parent | 4499cc8bb65e217e1cb2959452ed391af82e757b (diff) | |
download | CMake-653b894683abe63233cb8679b34ea39d9017e317.zip CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.gz CMake-653b894683abe63233cb8679b34ea39d9017e317.tar.bz2 |
Reduce raw string pointers usage.
* Change some functions to take `std::string` instead of
`const char*` in the following classes: `cmMakeFile`, `cmake`,
`cmCoreTryCompile`, `cmSystemTools`, `cmState`, `cmLocalGenerator`
and a few others.
* Greatly reduce using of `const char*` overloads for
`cmSystemTools::MakeDirectory` and `cmSystemTools::RelativePath`.
* Remove many redundant `c_str()` conversions throughout the code.
Diffstat (limited to 'Source/CPack/cmCPackGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 54a2a27..d838b30 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -187,7 +187,7 @@ int cmCPackGenerator::InstallProject() const char* tempInstallDirectory = tempInstallDirectoryStr.c_str(); int res = 1; - if (!cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory.c_str())) { + if (!cmsys::SystemTools::MakeDirectory(bareTempInstallDirectory)) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem creating temporary directory: " << (tempInstallDirectory ? tempInstallDirectory : "(NULL)") @@ -374,15 +374,14 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( continue; } std::string filePath = tempDir; - filePath += "/" + subdir + "/" + - cmSystemTools::RelativePath(top.c_str(), gf.c_str()); + filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(top, gf); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " << inFile << " -> " << filePath << std::endl); /* If the file is a symlink we will have to re-create it */ if (cmSystemTools::FileIsSymlink(inFile)) { std::string targetFile; std::string inFileRelative = - cmSystemTools::RelativePath(top.c_str(), inFile.c_str()); + cmSystemTools::RelativePath(top, inFile); cmSystemTools::ReadSymlink(inFile, targetFile); symlinkedFiles.emplace_back(std::move(targetFile), std::move(inFileRelative)); @@ -772,9 +771,9 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( } // Remember the list of files before installation // of the current component (if we are in component install) - const char* InstallPrefix = tempInstallDirectory.c_str(); + std::string const& InstallPrefix = tempInstallDirectory; std::vector<std::string> filesBefore; - std::string findExpr(InstallPrefix); + std::string findExpr = tempInstallDirectory; if (componentInstall) { cmsys::Glob glB; findExpr += "/*"; @@ -829,8 +828,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::string localFileName; // Populate the File field of each component for (fit = result.begin(); fit != diff; ++fit) { - localFileName = - cmSystemTools::RelativePath(InstallPrefix, fit->c_str()); + localFileName = cmSystemTools::RelativePath(InstallPrefix, *fit); localFileName = localFileName.substr(localFileName.find_first_not_of('/')); Components[installComponent].Files.push_back(localFileName); |