Commit 7f2bb732 authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'source_sweep_cmStrCat'

9b334397 Source sweep: Use cmStrCat for string concatenation
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: Rolf Eike Beer's avatarRolf Eike Beer <eike@sf-mail.de>
Acked-by: Daniel Pfeifer's avatarDaniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !3699
parents 68126f5a 9b334397
Pipeline #144608 passed with stage
in 0 seconds
......@@ -35,8 +35,7 @@ int cmCPackIFWGenerator::PackageFiles()
this->Installer.GeneratePackageFiles();
std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string ifwTmpFile = ifwTLD;
ifwTmpFile += "/IFWOutput.log";
std::string ifwTmpFile = cmStrCat(ifwTLD, "/IFWOutput.log");
// Run repogen
if (!this->Installer.RemoteRepositories.empty()) {
......@@ -117,8 +116,8 @@ int cmCPackIFWGenerator::PackageFiles()
// Run binary creator
{
std::string ifwCmd = this->BinCreator;
ifwCmd += " -c " + this->toplevel + "/config/config.xml";
std::string ifwCmd =
cmStrCat(this->BinCreator, " -c ", this->toplevel, "/config/config.xml");
if (!this->Installer.Resources.empty()) {
ifwCmd += " -r ";
......
......@@ -193,8 +193,8 @@ void cmCPackIFWInstaller::ConfigureFromOptions()
this->TargetDir = optIFW_TARGET_DIRECTORY;
} else if (const char* optPACKAGE_INSTALL_DIRECTORY =
this->GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY")) {
this->TargetDir = "@ApplicationsDir@/";
this->TargetDir += optPACKAGE_INSTALL_DIRECTORY;
this->TargetDir =
cmStrCat("@ApplicationsDir@/", optPACKAGE_INSTALL_DIRECTORY);
} else {
this->TargetDir = "@RootDir@/usr/local";
}
......
......@@ -11,6 +11,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmUuid.h"
#include "cm_string_view.hxx"
#include <algorithm>
#include "cmWIXDirectoriesSourceWriter.h"
......@@ -519,9 +520,7 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
for (auto const& i : this->Components) {
cmCPackComponent const& component = i.second;
std::string componentPath = toplevel;
componentPath += "/";
componentPath += component.Name;
std::string componentPath = cmStrCat(toplevel, '/', component.Name);
std::string const componentFeatureId = "CM_C_" + component.Name;
......@@ -1087,8 +1086,7 @@ std::string cmCPackWIXGenerator::CreateHashedId(
cmCryptoHash sha1(cmCryptoHash::AlgoSHA1);
std::string const hash = sha1.HashString(path);
std::string identifier;
identifier += hash.substr(0, 7) + "_";
std::string identifier = cmStrCat(cm::string_view(hash).substr(0, 7), '_');
const size_t maxFileNameLength = 52;
if (normalizedFilename.length() > maxFileNameLength) {
......
......@@ -6,6 +6,7 @@
#include "cmCPackGenerator.h"
#include "cmCPackLog.h"
#include "cmGeneratedFileStream.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmWorkingDirectory.h"
......@@ -71,8 +72,7 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
}
std::string filePrefix;
if (this->IsOn("CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY")) {
filePrefix = this->GetOption("CPACK_PACKAGE_FILE_NAME");
filePrefix += "/";
filePrefix = cmStrCat(this->GetOption("CPACK_PACKAGE_FILE_NAME"), '/');
}
const char* installPrefix =
this->GetOption("CPACK_PACKAGING_INSTALL_PREFIX");
......
......@@ -41,9 +41,8 @@ int cmCPackBundleGenerator::InitializeInternal()
const char* cmCPackBundleGenerator::GetPackagingInstallPrefix()
{
this->InstallPrefix = "/";
this->InstallPrefix += this->GetOption("CPACK_BUNDLE_NAME");
this->InstallPrefix += ".app/Contents/Resources";
this->InstallPrefix = cmStrCat('/', this->GetOption("CPACK_BUNDLE_NAME"),
".app/Contents/Resources");
return this->InstallPrefix.c_str();
}
......@@ -191,9 +190,8 @@ int cmCPackBundleGenerator::SignBundle(const std::string& src_dir)
if (!cpack_apple_cert_app.empty()) {
std::string output;
std::string bundle_path;
bundle_path = src_dir + "/";
bundle_path += this->GetOption("CPACK_BUNDLE_NAME");
bundle_path += ".app";
bundle_path =
cmStrCat(src_dir, '/', this->GetOption("CPACK_BUNDLE_NAME"), ".app");
// A list of additional files to sign, ie. frameworks and plugins.
const std::string sign_parameter =
......
......@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCPackComponentGroup.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include <string>
......@@ -14,9 +15,7 @@ unsigned long cmCPackComponent::GetInstalledSize(
}
for (std::string const& file : this->Files) {
std::string path = installDir;
path += '/';
path += file;
std::string path = cmStrCat(installDir, '/', file);
this->TotalSize += cmSystemTools::FileLength(path);
}
......
......@@ -28,13 +28,11 @@ int cmCPackCygwinBinaryGenerator::InitializeInternal()
int cmCPackCygwinBinaryGenerator::PackageFiles()
{
std::string packageName = this->GetOption("CPACK_PACKAGE_NAME");
packageName += "-";
packageName += this->GetOption("CPACK_PACKAGE_VERSION");
std::string packageName =
cmStrCat(this->GetOption("CPACK_PACKAGE_NAME"), '-',
this->GetOption("CPACK_PACKAGE_VERSION"));
packageName = cmsys::SystemTools::LowerCase(packageName);
std::string manifest = "/usr/share/doc/";
manifest += packageName;
manifest += "/MANIFEST";
std::string manifest = cmStrCat("/usr/share/doc/", packageName, "/MANIFEST");
std::string manifestFile = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
// Create a MANIFEST file that contains all of the files in
// the tar file
......
......@@ -37,8 +37,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
{
// Create a tar file of the sources
std::string packageDirFileName =
this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packageDirFileName += ".tar.bz2";
cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".tar.bz2");
packageFileNames[0] = packageDirFileName;
std::string output;
// skip one parent up to the cmCPackTarBZip2Generator
......@@ -94,8 +93,8 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
<< this->GetOption("CPACK_TOPLEVEL_DIRECTORY") << "]\n");
return 0;
}
std::string outerTarFile = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
outerTarFile += "-";
std::string outerTarFile =
cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), '-');
const char* patch = this->GetOption("CPACK_CYGWIN_PATCH_NUMBER");
if (!patch) {
cmCPackLogger(cmCPackLog::LOG_WARNING,
......@@ -106,19 +105,18 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
outerTarFile += patch;
outerTarFile += "-src.tar.bz2";
std::string tmpDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string buildScript = tmpDir;
buildScript += "/";
buildScript += cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT"));
std::string patchFile = tmpDir;
patchFile += "/";
patchFile +=
cmSystemTools::GetFilenameName(this->GetOption("CPACK_CYGWIN_PATCH_FILE"));
std::string buildScript =
cmStrCat(tmpDir, '/',
cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_BUILD_SCRIPT")));
std::string patchFile =
cmStrCat(tmpDir, '/',
cmSystemTools::GetFilenameName(
this->GetOption("CPACK_CYGWIN_PATCH_FILE")));
std::string file = cmSystemTools::GetFilenameName(compressOutFile);
std::string sourceTar = cmSystemTools::GetFilenamePath(compressOutFile);
sourceTar += "/";
sourceTar += file;
std::string sourceTar =
cmStrCat(cmSystemTools::GetFilenamePath(compressOutFile), '/', file);
/* reset list of file to be packaged */
files.clear();
// a source release in cygwin should have the build script used
......@@ -140,8 +138,8 @@ int cmCPackCygwinSourceGenerator::PackageFiles()
const char* cmCPackCygwinSourceGenerator::GetPackagingInstallPrefix()
{
this->InstallPrefix = "/";
this->InstallPrefix += this->GetOption("CPACK_PACKAGE_FILE_NAME");
this->InstallPrefix =
cmStrCat('/', this->GetOption("CPACK_PACKAGE_FILE_NAME"));
return this->InstallPrefix.c_str();
}
......
......@@ -149,8 +149,7 @@ void DebGenerator::generateControlFile() const
unsigned long totalSize = 0;
{
std::string dirName = TemporaryDir;
dirName += '/';
std::string dirName = cmStrCat(TemporaryDir, '/');
for (std::string const& file : PackageFiles) {
totalSize += cmSystemTools::FileLength(file);
}
......@@ -248,8 +247,7 @@ std::string DebGenerator::generateMD5File() const
cmGeneratedFileStream out(md5filename);
std::string topLevelWithTrailingSlash = TemporaryDir;
topLevelWithTrailingSlash += '/';
std::string topLevelWithTrailingSlash = cmStrCat(TemporaryDir, '/');
for (std::string const& file : PackageFiles) {
// hash only regular files
if (cmSystemTools::FileIsDirectory(file) ||
......@@ -469,8 +467,7 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
// Tell CPackDeb.cmake the name of the component GROUP.
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT", packageName.c_str());
// Tell CPackDeb.cmake the path where the component is.
std::string component_path = "/";
component_path += packageName;
std::string component_path = cmStrCat('/', packageName);
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
component_path.c_str());
if (!this->ReadListFile("Internal/CPack/CPackDeb.cmake")) {
......@@ -500,9 +497,8 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
retval = 0;
}
// add the generated package to package file names list
packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
packageFileName += "/";
packageFileName += this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME");
packageFileName = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/',
this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"));
packageFileNames.push_back(std::move(packageFileName));
if (this->IsOn("GEN_CPACK_DEBIAN_DEBUGINFO_PACKAGE")) {
......@@ -524,9 +520,9 @@ int cmCPackDebGenerator::PackageOnePack(std::string const& initialTopLevel,
retval = 0;
}
// add the generated package to package file names list
packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
packageFileName += "/";
packageFileName += this->GetOption("GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME");
packageFileName =
cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/',
this->GetOption("GEN_CPACK_DBGSYM_OUTPUT_FILE_NAME"));
packageFileNames.push_back(std::move(packageFileName));
}
......@@ -614,8 +610,7 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(
if (!compInstDirName.empty()) {
// Tell CPackDeb.cmake the path where the component is.
std::string component_path = "/";
component_path += compInstDirName;
std::string component_path = cmStrCat('/', compInstDirName);
this->SetOption("CPACK_DEB_PACKAGE_COMPONENT_PART_PATH",
component_path.c_str());
}
......@@ -644,9 +639,8 @@ int cmCPackDebGenerator::PackageComponentsAllInOne(
retval = 0;
}
// add the generated package to package file names list
packageFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
packageFileName += "/";
packageFileName += this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME");
packageFileName = cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), '/',
this->GetOption("GEN_CPACK_OUTPUT_FILE_NAME"));
packageFileNames.push_back(std::move(packageFileName));
return retval;
}
......
......@@ -196,9 +196,7 @@ int cmCPackDragNDropGenerator::PackageFiles()
full_package_name += std::string(GetOutputExtension());
packageFileNames.push_back(full_package_name);
std::string src_dir = toplevel;
src_dir += "/";
src_dir += package_file;
std::string src_dir = cmStrCat(toplevel, '/', package_file);
if (0 == this->CreateDMG(src_dir, full_package_name)) {
return 0;
......@@ -409,8 +407,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
}
// Create a temporary read-write disk image ...
std::string temp_image = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
temp_image += "/temp.dmg";
std::string temp_image =
cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/temp.dmg");
std::string create_error;
std::ostringstream temp_image_command;
......@@ -522,8 +520,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
if (!cpack_license_file.empty() || !slaDirectory.empty()) {
// Use old hardcoded style if sla_dir is not set
bool oldStyle = slaDirectory.empty();
std::string sla_r = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
sla_r += "/sla.r";
std::string sla_r =
cmStrCat(this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/sla.r");
std::vector<std::string> languages;
if (!oldStyle) {
......@@ -649,8 +647,8 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
if (temp_image_format != "UDZO") {
temp_image_format = "UDZO";
// convert to UDZO to enable unflatten/flatten
std::string temp_udzo = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
temp_udzo += "/temp-udzo.dmg";
std::string temp_udzo = cmStrCat(
this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/temp-udzo.dmg");
std::ostringstream udco_image_command;
udco_image_command << this->GetOption("CPACK_COMMAND_HDIUTIL");
......
......@@ -73,8 +73,8 @@ int cmCPackGenerator::PrepareNames()
}
}
std::string tempDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
tempDirectory += "/_CPack_Packages/";
std::string tempDirectory =
cmStrCat(this->GetOption("CPACK_PACKAGE_DIRECTORY"), "/_CPack_Packages/");
const char* toplevelTag = this->GetOption("CPACK_TOPLEVEL_TAG");
if (toplevelTag) {
tempDirectory += toplevelTag;
......@@ -197,8 +197,7 @@ int cmCPackGenerator::InstallProject()
}
if (setDestDir) {
std::string destDir = "DESTDIR=";
destDir += tempInstallDirectory;
std::string destDir = cmStrCat("DESTDIR=", tempInstallDirectory);
cmSystemTools::PutEnv(destDir);
} else {
// Make sure there is no destdir
......@@ -271,8 +270,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
(void)setDestDir;
const char* installCommands = this->GetOption("CPACK_INSTALL_COMMANDS");
if (installCommands && *installCommands) {
std::string tempInstallDirectoryEnv = "CMAKE_INSTALL_PREFIX=";
tempInstallDirectoryEnv += tempInstallDirectory;
std::string tempInstallDirectoryEnv =
cmStrCat("CMAKE_INSTALL_PREFIX=", tempInstallDirectory);
cmSystemTools::PutEnv(tempInstallDirectoryEnv);
std::vector<std::string> installCommandsVector;
cmExpandList(installCommands, installCommandsVector);
......@@ -284,8 +283,8 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
ic, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
cmDuration::zero());
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/InstallOutput.log";
std::string tmpFile = cmStrCat(
this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/InstallOutput.log");
cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << ic << std::endl
<< "# Output:" << std::endl
......@@ -343,8 +342,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
std::string top = *it;
it++;
std::string subdir = *it;
std::string findExpr = top;
findExpr += "/*";
std::string findExpr = cmStrCat(top, "/*");
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
"- Install directory: " << top << std::endl);
gl.RecurseOn();
......@@ -372,8 +370,8 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
if (skip) {
continue;
}
std::string filePath = tempDir;
filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(top, gf);
std::string filePath = cmStrCat(tempDir, '/', subdir, '/',
cmSystemTools::RelativePath(top, gf));
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Copy file: " << inFile << " -> " << filePath
<< std::endl);
......@@ -398,8 +396,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories(
/* rebuild symlinks in the installed tree */
if (!symlinkedFiles.empty()) {
std::string curDir = cmSystemTools::GetCurrentWorkingDirectory();
std::string goToDir = tempDir;
goToDir += "/" + subdir;
std::string goToDir = cmStrCat(tempDir, '/', subdir);
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"Change dir to: " << goToDir << std::endl);
cmWorkingDirectory workdir(goToDir);
......@@ -662,8 +659,8 @@ int cmCPackGenerator::RunPreinstallTarget(
buildCommand, &output, &output, &retVal, installDirectory.c_str(),
this->GeneratorVerbose, cmDuration::zero());
if (!resB || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/PreinstallOutput.log";
std::string tmpFile = cmStrCat(
this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/PreinstallOutput.log");
cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << buildCommand << std::endl
<< "# Directory: " << installDirectory << std::endl
......@@ -911,10 +908,8 @@ int cmCPackGenerator::InstallCMakeProject(
GetComponentInstallDirNameSuffix(component);
if (nullptr != this->GetOption(absoluteDestFileComponent)) {
std::string absoluteDestFilesListComponent =
this->GetOption(absoluteDestFileComponent);
absoluteDestFilesListComponent += ";";
absoluteDestFilesListComponent +=
mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES");
cmStrCat(this->GetOption(absoluteDestFileComponent), ';',
mf.GetDefinition("CPACK_ABSOLUTE_DESTINATION_FILES"));
this->SetOption(absoluteDestFileComponent,
absoluteDestFilesListComponent.c_str());
} else {
......@@ -1006,8 +1001,7 @@ int cmCPackGenerator::DoPackage()
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
cmsys::Glob gl;
std::string findExpr = tempDirectory;
findExpr += "/*";
std::string findExpr = cmStrCat(tempDirectory, "/*");
gl.RecurseOn();
gl.SetRecurseListDirs(true);
gl.SetRecurseThroughSymlinks(false);
......@@ -1203,8 +1197,7 @@ const char* cmCPackGenerator::GetInstallPath()
if (cmsys::SystemTools::GetEnv("ProgramFiles", prgfiles)) {
this->InstallPath = prgfiles;
} else if (cmsys::SystemTools::GetEnv("SystemDrive", sysDrive)) {
this->InstallPath = sysDrive;
this->InstallPath += "/Program Files";
this->InstallPath = cmStrCat(sysDrive, "/Program Files");
} else {
this->InstallPath = "c:/Program Files";
}
......
......@@ -56,8 +56,7 @@ int cmCPackNSISGenerator::PackageFiles()
}
std::string nsisFileName = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string tmpFile = nsisFileName;
tmpFile += "/NSISOutput.log";
std::string tmpFile = cmStrCat(nsisFileName, "/NSISOutput.log");
std::string nsisInstallOptions = nsisFileName + "/NSIS.InstallOptions.ini";
nsisFileName += "/project.nsi";
std::ostringstream str;
......@@ -142,39 +141,34 @@ int cmCPackNSISGenerator::PackageFiles()
installerIconCode.c_str());
}
if (this->IsSet("CPACK_PACKAGE_ICON")) {
std::string installerIconCode = "!define MUI_HEADERIMAGE_BITMAP \"";
installerIconCode += this->GetOption("CPACK_PACKAGE_ICON");
installerIconCode += "\"\n";
std::string installerIconCode =
cmStrCat("!define MUI_HEADERIMAGE_BITMAP \"",
this->GetOption("CPACK_PACKAGE_ICON"), "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_ICON_CODE",
installerIconCode.c_str());
}
if (this->IsSet("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP")) {
std::string installerBitmapCode =
"!define MUI_WELCOMEFINISHPAGE_BITMAP \"";
installerBitmapCode +=
this->GetOption("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP");
installerBitmapCode += "\"\n";
std::string installerBitmapCode = cmStrCat(
"!define MUI_WELCOMEFINISHPAGE_BITMAP \"",
this->GetOption("CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP"), "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_WELCOMEFINISH_CODE",
installerBitmapCode.c_str());
}
if (this->IsSet("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP")) {
std::string installerBitmapCode =
"!define MUI_UNWELCOMEFINISHPAGE_BITMAP \"";
installerBitmapCode +=
this->GetOption("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP");
installerBitmapCode += "\"\n";
std::string installerBitmapCode = cmStrCat(
"!define MUI_UNWELCOMEFINISHPAGE_BITMAP \"",
this->GetOption("CPACK_NSIS_MUI_UNWELCOMEFINISHPAGE_BITMAP"), "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_UNWELCOMEFINISH_CODE",
installerBitmapCode.c_str());
}
if (this->IsSet("CPACK_NSIS_MUI_FINISHPAGE_RUN")) {
std::string installerRunCode = "!define MUI_FINISHPAGE_RUN \"$INSTDIR\\";
installerRunCode += this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY");
installerRunCode += "\\";
installerRunCode += this->GetOption("CPACK_NSIS_MUI_FINISHPAGE_RUN");
installerRunCode += "\"\n";
std::string installerRunCode =
cmStrCat("!define MUI_FINISHPAGE_RUN \"$INSTDIR\\",
this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY"), '\\',
this->GetOption("CPACK_NSIS_MUI_FINISHPAGE_RUN"), "\"\n");
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE",
installerRunCode.c_str());
}
......@@ -297,9 +291,9 @@ int cmCPackNSISGenerator::PackageFiles()
this->ConfigureFile(nsisInInstallOptions, nsisInstallOptions);
this->ConfigureFile(nsisInFileName, nsisFileName);
std::string nsisCmd = "\"";
nsisCmd += this->GetOption("CPACK_INSTALLER_PROGRAM");
nsisCmd += "\" \"" + nsisFileName + "\"";
std::string nsisCmd =
cmStrCat('"', this->GetOption("CPACK_INSTALLER_PROGRAM"), "\" \"",
nsisFileName, '"');
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl);
std::string output;
int retVal = 1;
......@@ -415,8 +409,7 @@ int cmCPackNSISGenerator::InitializeInternal()
if (!resS || retVal ||
(!versionRex.find(output) && !versionRexCVS.find(output))) {
const char* topDir = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
std::string tmpFile = topDir ? topDir : ".";
tmpFile += "/NSISOutput.log";
std::string tmpFile = cmStrCat(topDir ? topDir : ".", "/NSISOutput.log");
cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << nsisCmd << std::endl
<< "# Output:" << std::endl
......@@ -573,8 +566,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostream& str,
}
// see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
// if so add a desktop link
std::string desktop = "CPACK_CREATE_DESKTOP_LINK_";
desktop += linkName;
std::string desktop = cmStrCat("CPACK_CREATE_DESKTOP_LINK_", linkName);
if (this->IsSet(desktop)) {
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
str << " CreateShortCut \"$DESKTOP\\" << linkName
......@@ -656,8 +648,8 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
if (component->IsDownloaded) {
if (component->ArchiveFile.empty()) {
// Compute the name of the archive.
std::string packagesDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
packagesDir += ".dummy";
std::string packagesDir =
cmStrCat(this->GetOption("CPACK_TEMPORARY_DIRECTORY"), ".dummy");
std::ostringstream out;
out << cmSystemTools::GetFilenameWithoutLastExtension(packagesDir) << "-"
<< component->Name << ".zip";
......@@ -671,8 +663,8 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
if (userUploadDirectory && *userUploadDirectory) {
uploadDirectory = userUploadDirectory;
} else {
uploadDirectory = this->GetOption("CPACK_PACKAGE_DIRECTORY");
uploadDirectory += "/CPackUploads";
uploadDirectory =
cmStrCat(this->GetOption("CPACK_PACKAGE_DIRECTORY"), "/CPackUploads");
}
if (!cmSystemTools::FileExists(uploadDirectory)) {
if (!cmSystemTools::MakeDirectory(uploadDirectory)) {
......@@ -709,15 +701,13 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
}
// The directory where this component's files reside
std::string dirName = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
dirName += '/';
dirName += component->Name;
dirName += '/';
std::string dirName = cmStrCat(
this->GetOption("CPACK_TEMPORARY_DIRECTORY"), '/', component->Name, '/');
// Build the list of files to go into this archive, and determine the
// size of the installed component.
std::string zipListFileName = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
zipListFileName += "/winZip.filelist";
std::string zipListFileName = cmStrCat(
this->GetOption("CPACK_TEMPORARY_DIRECTORY"), "/winZip.filelist");
bool needQuotesInFile = cmIsOn(this->GetOption("CPACK_ZIP_NEED_QUOTES"));
unsigned long totalSize = 0;
{ // the scope is needed for cmGeneratedFileStream
......@@ -747,8 +737,8 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
cmd, &output, &output, &retVal, dirName.c_str(),
cmSystemTools::OUTPUT_NONE, cmDuration::zero());
if (!res || retVal) {
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
tmpFile += "/CompressZip.log";
std::string tmpFile = cmStrCat(
this->GetOption("CPACK_TOPLEVEL_DIRECTORY"), "/CompressZip.log");
cmGeneratedFileStream ofs(tmpFile);
ofs << "# Run command: " << cmd << std::endl
<< "# Output:" << std::endl
......
......@@ -55,16 +55,14 @@ int cmCPackOSXX11Generator::PackageFiles()
diskImageDirectory + "/.background";
// App bundle directories
std::string packageDirFileName = toplevel;
packageDirFileName += "/";
packageDirFileName += this->GetOption("CPACK_PACKAGE_FILE_NAME");
packageDirFileName += ".app";
std::string packageDirFileName = cmStrCat(
toplevel, '/', this->GetOption("CPACK_PACKAGE_FILE_NAME"), ".app");
std::string contentsDirectory = packageDirFileName + "/Contents";
std::string resourcesDirectory = contentsDirectory + "/Resources";
std::string appDirectory = contentsDirectory + "/MacOS";
std::string scriptDirectory = resourcesDirectory + "/Scripts";
std::string resourceFileName = this->GetOption("CPACK_PACKAGE_FILE_NAME");
resourceFileName += ".rsrc";
std::string resourceFileName =
cmStrCat(this->GetOption("CPACK_PACKAGE_FILE_NAME"), ".rsrc");
const char* dir = resourcesDirectory.c_str();
const char* appdir = appDirectory.c_str();
......@@ -113,13 +111,10 @@ int cmCPackOSXX11Generator::PackageFiles()
}
// Two of the files need to have execute permission, so ensure they do:
std::string runTimeScript = dir;
runTimeScript += "/";
runTimeScript += "RuntimeScript";
std::string runTimeScript = cmStrCat(dir, "/RuntimeScript");
std::string appScriptName = appdir;
appScriptName += "/";
appScriptName += this->GetOption("CPACK_PACKAGE_FILE_NAME");
std::string appScriptName =
cmStrCat(appdir, '/', this->GetOption("CPACK_PACKAGE_FILE_NAME"));
mode_t mode;
if (cmsys::SystemTools::GetPermissions(runTimeScript.c_str(), mode)) {
......@@ -139,8 +134,8 @@ int cmCPackOSXX11Generator::PackageFiles()