Commit d48c781f authored by Nils Gladitz's avatar Nils Gladitz

CPackWiX: Extend CPACK_WIX_ACL to support directories

parent 58dc05de
CPACK_WIX_ACL
-------------
Specifies access permissions for files installed by a WiX installer.
Specifies access permissions for files or directories
installed by a WiX installer.
The property can contain multiple list entries,
each of which has to match the following format.
......
......@@ -847,13 +847,37 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
cmsys::Directory dir;
dir.Load(topdir.c_str());
if(dir.GetNumberOfFiles() == 2)
std::string relativeDirectoryPath =
cmSystemTools::RelativePath(toplevel.c_str(), topdir.c_str());
cmInstalledFile const* directoryInstalledFile =
this->GetInstalledFile(relativeDirectoryPath);
bool emptyDirectory = dir.GetNumberOfFiles() == 2;
bool createDirectory = false;
if(emptyDirectory)
{
std::string componentId = fileDefinitions.EmitComponentCreateFolder(
directoryId, GenerateGUID());
createDirectory = true;
}
if(directoryInstalledFile)
{
if(directoryInstalledFile->HasProperty("CPACK_WIX_ACL"))
{
createDirectory = true;
}
}
if(createDirectory)
{
std::string componentId = fileDefinitions.EmitComponentCreateFolder(
directoryId, GenerateGUID(), directoryInstalledFile);
featureDefinitions.EmitComponentRef(componentId);
}
if(emptyDirectory)
{
return;
}
......
......@@ -113,7 +113,9 @@ void cmWIXFilesSourceWriter::EmitUninstallShortcut(
}
std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder(
std::string const& directoryId, std::string const& guid)
std::string const& directoryId,
std::string const& guid,
cmInstalledFile const* installedFile)
{
std::string componentId =
std::string("CM_C_EMPTY_") + directoryId;
......@@ -127,6 +129,12 @@ std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder(
BeginElement("CreateFolder");
if(installedFile)
{
cmWIXAccessControlList acl(Logger, *installedFile, *this);
acl.Apply();
}
EndElement("CreateFolder");
EndElement("Component");
EndElement("DirectoryRef");
......
......@@ -47,7 +47,8 @@ public:
std::string EmitComponentCreateFolder(
std::string const& directoryId,
std::string const& guid);
std::string const& guid,
cmInstalledFile const* installedFile);
std::string EmitComponentFile(
std::string const& directoryId,
......
......@@ -76,6 +76,13 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf,
property.ValueExpressions.push_back(ge.Parse(value).release());
}
//----------------------------------------------------------------------------
bool cmInstalledFile::HasProperty(
const std::string& prop) const
{
return this->Properties.find(prop) != this->Properties.end();
}
//----------------------------------------------------------------------------
bool cmInstalledFile::GetProperty(
const std::string& prop, std::string& value) const
......
......@@ -62,6 +62,8 @@ public:
void AppendProperty(cmMakefile const* mf,
const std::string& prop, const char* value,bool asString=false);
bool HasProperty(const std::string& prop) const;
bool GetProperty(const std::string& prop, std::string& value) const;
bool GetPropertyAsBool(const std::string& prop) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment