diff options
Diffstat (limited to 'Source/CPack')
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWInstaller.cxx | 31 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWPackage.cxx | 16 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/CPack/WiX/cmCPackWIXGenerator.h | 2 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx | 4 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXFilesSourceWriter.cxx | 4 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatch.cxx | 6 | ||||
-rw-r--r-- | Source/CPack/WiX/cmWIXPatchParser.cxx | 26 |
8 files changed, 58 insertions, 45 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx index 3aebbc8..5e5f066 100644 --- a/Source/CPack/IFW/cmCPackIFWInstaller.cxx +++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx @@ -171,17 +171,17 @@ void cmCPackIFWInstaller::ConfigureFromOptions() // WizardStyle if (const char* option = GetOption("CPACK_IFW_PACKAGE_WIZARD_STYLE")) { - if (WizardStyle.compare("Modern") == 0 && - WizardStyle.compare("Aero") == 0 && WizardStyle.compare("Mac") == 0 && - WizardStyle.compare("Classic") == 0) { + // Setting the user value in any case + WizardStyle = option; + // Check known values + if (WizardStyle != "Modern" && WizardStyle != "Aero" && + WizardStyle != "Mac" && WizardStyle != "Classic") { cmCPackLogger( cmCPackLog::LOG_WARNING, "Option CPACK_IFW_PACKAGE_WIZARD_STYLE has unknown value \"" << option << "\". Expected values are: Modern, Aero, Mac, Classic." << std::endl); } - - WizardStyle = option; } // WizardDefaultWidth @@ -288,7 +288,7 @@ public: hasFiles = false; hasErrors = false; - basePath = cmSystemTools::GetFilenamePath(installer->Resources[r].data()); + basePath = cmSystemTools::GetFilenamePath(installer->Resources[r]); ParseFile(installer->Resources[r].data()); @@ -360,8 +360,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() cmSystemTools::GetFilenameName(InstallerApplicationIcon); std::string path = Directory + "/config/" + name; name = cmSystemTools::GetFilenameWithoutExtension(name); - cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon.data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(InstallerApplicationIcon, path); xout.Element("InstallerApplicationIcon", name); } @@ -369,8 +368,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!InstallerWindowIcon.empty()) { std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon.data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(InstallerWindowIcon, path); xout.Element("InstallerWindowIcon", name); } @@ -378,7 +376,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Logo.empty()) { std::string name = cmSystemTools::GetFilenameName(Logo); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Logo, path); xout.Element("Logo", name); } @@ -386,7 +384,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Banner.empty()) { std::string name = cmSystemTools::GetFilenameName(Banner); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Banner.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Banner, path); xout.Element("Banner", name); } @@ -394,7 +392,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Watermark.empty()) { std::string name = cmSystemTools::GetFilenameName(Watermark); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Watermark.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Watermark, path); xout.Element("Watermark", name); } @@ -402,7 +400,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!Background.empty()) { std::string name = cmSystemTools::GetFilenameName(Background); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Background.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Background, path); xout.Element("Background", name); } @@ -480,7 +478,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (!IsVersionLess("2.0") && !ControlScript.empty()) { std::string name = cmSystemTools::GetFilenameName(ControlScript); std::string path = Directory + "/config/" + name; - cmsys::SystemTools::CopyFileIfDifferent(ControlScript.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(ControlScript, path); xout.Element("ControlScript", name); } @@ -492,8 +490,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile() if (parser.ParseResource(i)) { std::string name = cmSystemTools::GetFilenameName(Resources[i]); std::string path = Directory + "/resources/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Resources[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Resources[i], path); resources.push_back(name); } else { cmCPackLogger(cmCPackLog::LOG_WARNING, "Can't copy resources from \"" diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx index 2a95ba8..eda383f 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.cxx +++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx @@ -514,11 +514,11 @@ int cmCPackIFWPackage::ConfigureFromPrefix(const std::string& prefix) Default.clear(); } else if (const char* value = GetOption(option)) { std::string lowerValue = cmsys::SystemTools::LowerCase(value); - if (lowerValue.compare("true") == 0) { + if (lowerValue == "true") { Default = "true"; - } else if (lowerValue.compare("false") == 0) { + } else if (lowerValue == "false") { Default = "false"; - } else if (lowerValue.compare("script") == 0) { + } else if (lowerValue == "script") { Default = "script"; } else { Default = value; @@ -590,7 +590,7 @@ void cmCPackIFWPackage::GeneratePackageFile() if (!Script.empty()) { std::string name = cmSystemTools::GetFilenameName(Script); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(Script, path); xout.Element("Script", name); } @@ -599,8 +599,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 0; i < userInterfaces.size(); i++) { std::string name = cmSystemTools::GetFilenameName(userInterfaces[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(userInterfaces[i], path); userInterfaces[i] = name; } if (!userInterfaces.empty()) { @@ -616,8 +615,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 0; i < translations.size(); i++) { std::string name = cmSystemTools::GetFilenameName(translations[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(translations[i].data(), - path.data()); + cmsys::SystemTools::CopyFileIfDifferent(translations[i], path); translations[i] = name; } if (!translations.empty()) { @@ -675,7 +673,7 @@ void cmCPackIFWPackage::GeneratePackageFile() for (size_t i = 1; i < licenses.size(); i += 2) { std::string name = cmSystemTools::GetFilenameName(licenses[i]); std::string path = Directory + "/meta/" + name; - cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data()); + cmsys::SystemTools::CopyFileIfDifferent(licenses[i], path); licenses[i] = name; } if (!licenses.empty()) { diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 2df23fd..274dfd0 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -677,10 +677,10 @@ bool cmCPackWIXGenerator::AddComponentsToFeature( cpackPackageDesktopLinksList); } - AddDirectoryAndFileDefinitons(rootPath, "INSTALL_ROOT", directoryDefinitions, - fileDefinitions, featureDefinitions, - cpackPackageExecutablesList, - cpackPackageDesktopLinksList, shortcuts); + AddDirectoryAndFileDefinitions( + rootPath, "INSTALL_ROOT", directoryDefinitions, fileDefinitions, + featureDefinitions, cpackPackageExecutablesList, + cpackPackageDesktopLinksList, shortcuts); featureDefinitions.EndElement("FeatureRef"); @@ -841,7 +841,7 @@ bool cmCPackWIXGenerator::CreateLicenseFile() return true; } -void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( +void cmCPackWIXGenerator::AddDirectoryAndFileDefinitions( std::string const& topdir, std::string const& directoryId, cmWIXDirectoriesSourceWriter& directoryDefinitions, cmWIXFilesSourceWriter& fileDefinitions, @@ -906,12 +906,12 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( directoryDefinitions.BeginElement("Directory"); directoryDefinitions.AddAttribute("Id", subDirectoryId); directoryDefinitions.AddAttribute("Name", fileName); + this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions); - AddDirectoryAndFileDefinitons( + AddDirectoryAndFileDefinitions( fullPath, subDirectoryId, directoryDefinitions, fileDefinitions, featureDefinitions, packageExecutables, desktopExecutables, shortcuts); - this->Patch->ApplyFragment(subDirectoryId, directoryDefinitions); directoryDefinitions.EndElement("Directory"); } else { cmInstalledFile const* installedFile = this->GetInstalledFile( diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h index 353d6c0..b2633a7 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.h +++ b/Source/CPack/WiX/cmCPackWIXGenerator.h @@ -104,7 +104,7 @@ private: bool RunLightCommand(std::string const& objectFiles); - void AddDirectoryAndFileDefinitons( + void AddDirectoryAndFileDefinitions( std::string const& topdir, std::string const& directoryId, cmWIXDirectoriesSourceWriter& directoryDefinitions, cmWIXFilesSourceWriter& fileDefinitions, diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index 79a9fdd..0be4377 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -44,6 +44,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( AddAttributeUnlessEmpty("Title", group.DisplayName); AddAttributeUnlessEmpty("Description", group.Description); + patch.ApplyFragment("CM_G_" + group.Name, *this); + for (std::vector<cmCPackComponentGroup*>::const_iterator i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i) { @@ -56,8 +58,6 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( EmitFeatureForComponent(**i, patch); } - patch.ApplyFragment("CM_G_" + group.Name, *this); - EndElement("Feature"); } diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx index 7aa1212..b4cd1a3 100644 --- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx @@ -136,6 +136,7 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( } } + patch.ApplyFragment(componentId, *this); BeginElement("File"); AddAttribute("Id", fileId); AddAttribute("Source", filePath); @@ -147,16 +148,15 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile( if (!(fileMode & S_IWRITE)) { AddAttribute("ReadOnly", "yes"); } + patch.ApplyFragment(fileId, *this); if (installedFile) { cmWIXAccessControlList acl(Logger, *installedFile, *this); acl.Apply(); } - patch.ApplyFragment(fileId, *this); EndElement("File"); - patch.ApplyFragment(componentId, *this); EndElement("Component"); EndElement("DirectoryRef"); diff --git a/Source/CPack/WiX/cmWIXPatch.cxx b/Source/CPack/WiX/cmWIXPatch.cxx index 3a7dbfd..287a644 100644 --- a/Source/CPack/WiX/cmWIXPatch.cxx +++ b/Source/CPack/WiX/cmWIXPatch.cxx @@ -29,7 +29,11 @@ void cmWIXPatch::ApplyFragment(std::string const& id, return; const cmWIXPatchElement& fragment = i->second; - + for (cmWIXPatchElement::attributes_t::const_iterator attr_i = + fragment.attributes.begin(); + attr_i != fragment.attributes.end(); ++attr_i) { + writer.AddAttribute(attr_i->first, attr_i->second); + } this->ApplyElementChildren(fragment, writer); Fragments.erase(i); diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 7f2ae19..0dcc74a 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -72,9 +72,11 @@ void cmWIXPatchParser::StartElement(const std::string& name, const char** atts) void cmWIXPatchParser::StartFragment(const char** attributes) { + cmWIXPatchElement* new_element = CM_NULLPTR; + /* find the id of for fragment */ for (size_t i = 0; attributes[i]; i += 2) { - std::string key = attributes[i]; - std::string value = attributes[i + 1]; + const std::string key = attributes[i]; + const std::string value = attributes[i + 1]; if (key == "Id") { if (Fragments.find(value) != Fragments.end()) { @@ -83,10 +85,22 @@ void cmWIXPatchParser::StartFragment(const char** attributes) ReportValidationError(tmp.str()); } - ElementStack.push_back(&Fragments[value]); - } else { - ReportValidationError( - "The only allowed 'CPackWixFragment' attribute is 'Id'"); + new_element = &Fragments[value]; + ElementStack.push_back(new_element); + } + } + + /* add any additional attributes for the fragement */ + if (!new_element) { + ReportValidationError("No 'Id' specified for 'CPackWixFragment' element"); + } else { + for (size_t i = 0; attributes[i]; i += 2) { + const std::string key = attributes[i]; + const std::string value = attributes[i + 1]; + + if (key != "Id") { + new_element->attributes[key] = value; + } } } } |