CPackWiX: Implement CPACK_NEVER_OVERWRITE and CPACK_PERMANENT properties

This commit is contained in:
Nils Gladitz 2014-05-16 22:43:56 +02:00 committed by Brad King
parent 15a8af21e8
commit d0b1d2a65b
6 changed files with 38 additions and 3 deletions

View File

@ -308,3 +308,6 @@ Properties on Installed Files
.. toctree::
:maxdepth: 1
/prop_inst/CPACK_NEVER_OVERWRITE.rst
/prop_inst/CPACK_PERMANENT.rst

View File

@ -0,0 +1,6 @@
CPACK_NEVER_OVERWRITE
---------------------
Request that this file not be overwritten on install or reinstall.
The property is currently only supported by the WIX generator.

View File

@ -0,0 +1,6 @@
CPACK_PERMANENT
---------------
Request that this file not be removed on uninstall.
The property is currently only supported by the WIX generator.

View File

@ -15,6 +15,7 @@
#include <cmSystemTools.h>
#include <cmGeneratedFileStream.h>
#include <cmCryptoHash.h>
#include <cmInstalledFile.h>
#include <CPack/cmCPackLog.h>
#include <CPack/cmCPackComponentGroup.h>
@ -871,8 +872,11 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
}
else
{
cmInstalledFile const* installedFile =
this->GetInstalledFile(relativePath);
std::string componentId = fileDefinitions.EmitComponentFile(
directoryId, id, fullPath, *(this->Patch));
directoryId, id, fullPath, *(this->Patch), installedFile);
featureDefinitions.EmitComponentRef(componentId);

View File

@ -12,6 +12,8 @@
#include "cmWIXFilesSourceWriter.h"
#include <cmInstalledFile.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -135,7 +137,8 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
std::string const& directoryId,
std::string const& id,
std::string const& filePath,
cmWIXPatch &patch)
cmWIXPatch &patch,
cmInstalledFile const* installedFile)
{
std::string componentId = std::string("CM_C") + id;
std::string fileId = std::string("CM_F") + id;
@ -147,6 +150,18 @@ std::string cmWIXFilesSourceWriter::EmitComponentFile(
AddAttribute("Id", componentId);
AddAttribute("Guid", "*");
if(installedFile)
{
if(installedFile->GetPropertyAsBool("CPACK_NEVER_OVERWRITE"))
{
AddAttribute("NeverOverwrite", "yes");
}
if(installedFile->GetPropertyAsBool("CPACK_PERMANENT"))
{
AddAttribute("Permanent", "yes");
}
}
BeginElement("File");
AddAttribute("Id", fileId);
AddAttribute("Source", filePath);

View File

@ -53,7 +53,8 @@ public:
std::string const& directoryId,
std::string const& id,
std::string const& filePath,
cmWIXPatch &patch);
cmWIXPatch &patch,
cmInstalledFile const* installedFile);
private:
void EmitInstallRegistryValue(