CPackWIX: Add new CPACK_STARTUP_SHORTCUTS property.

This commit is contained in:
Nils Gladitz 2015-02-21 18:07:36 +01:00
parent 279605f560
commit e6731f486e
7 changed files with 47 additions and 1 deletions

View File

@ -324,6 +324,7 @@ Properties on Installed Files
/prop_inst/CPACK_NEVER_OVERWRITE.rst
/prop_inst/CPACK_PERMANENT.rst
/prop_inst/CPACK_START_MENU_SHORTCUTS.rst
/prop_inst/CPACK_STARTUP_SHORTCUTS.rst
/prop_inst/CPACK_WIX_ACL.rst

View File

@ -0,0 +1,7 @@
CPACK_STARTUP_SHORTCUTS
-----------------------
Species a list of shortcut names that should be created in the Startup folder
for this file.
The property is currently only supported by the WIX generator.

View File

@ -557,6 +557,12 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
directoryDefinitions.EmitDesktopFolder();
}
if(emittedShortcutTypes.find(cmWIXShortcuts::STARTUP) !=
emittedShortcutTypes.end())
{
directoryDefinitions.EmitStartupFolder();
}
directoryDefinitions.EndElement("Directory");
directoryDefinitions.EndElement("Fragment");
@ -714,6 +720,17 @@ bool cmCPackWIXGenerator::CreateShortcuts(
}
}
if(!shortcuts.empty(cmWIXShortcuts::STARTUP))
{
if(!this->CreateShortcutsOfSpecificType(cmWIXShortcuts::STARTUP,
cpackComponentName, featureId, "STARTUP",
shortcuts, false,
fileDefinitions, featureDefinitions))
{
return false;
}
}
return true;
}
@ -736,6 +753,9 @@ bool cmCPackWIXGenerator::CreateShortcutsOfSpecificType(
case cmWIXShortcuts::DESKTOP:
directoryId = "DesktopFolder";
break;
case cmWIXShortcuts::STARTUP:
directoryId = "StartupFolder";
break;
default:
return false;
}

View File

@ -41,6 +41,14 @@ void cmWIXDirectoriesSourceWriter::EmitDesktopFolder()
EndElement("Directory");
}
void cmWIXDirectoriesSourceWriter::EmitStartupFolder()
{
BeginElement("Directory");
AddAttribute("Id", "StartupFolder");
AddAttribute("Name", "Startup");
EndElement("Directory");
}
size_t cmWIXDirectoriesSourceWriter::BeginInstallationPrefixDirectory(
std::string const& programFilesFolderId,
std::string const& installRootString)

View File

@ -32,6 +32,8 @@ public:
void EmitDesktopFolder();
void EmitStartupFolder();
size_t BeginInstallationPrefixDirectory(
std::string const& programFilesFolderId,
std::string const& installRootString);

View File

@ -52,6 +52,10 @@ bool cmWIXShortcuts::EmitShortcuts(
shortcutPrefix = "CM_DS";
registrySuffix = "_desktop";
break;
case STARTUP:
shortcutPrefix = "CM_SS";
registrySuffix = "_startup";
break;
default:
return false;
}
@ -96,6 +100,9 @@ void cmWIXShortcuts::CreateFromProperties(
CreateFromProperty("CPACK_DESKTOP_SHORTCUTS",
DESKTOP, id, directoryId, installedFile);
CreateFromProperty("CPACK_STARTUP_SHORTCUTS",
STARTUP, id, directoryId, installedFile);
}
void cmWIXShortcuts::CreateFromProperty(

View File

@ -34,7 +34,8 @@ public:
enum Type
{
START_MENU,
DESKTOP
DESKTOP,
STARTUP
};
typedef std::vector<cmWIXShortcut> shortcut_list_t;