CPackWiX: Extend CPACK_WIX_ACL to support directories
This commit is contained in:
parent
58dc05de9e
commit
d48c781fc2
@ -1,7 +1,8 @@
|
|||||||
CPACK_WIX_ACL
|
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,
|
The property can contain multiple list entries,
|
||||||
each of which has to match the following format.
|
each of which has to match the following format.
|
||||||
|
@ -847,13 +847,37 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
|
|||||||
cmsys::Directory dir;
|
cmsys::Directory dir;
|
||||||
dir.Load(topdir.c_str());
|
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)
|
||||||
|
{
|
||||||
|
createDirectory = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(directoryInstalledFile)
|
||||||
|
{
|
||||||
|
if(directoryInstalledFile->HasProperty("CPACK_WIX_ACL"))
|
||||||
|
{
|
||||||
|
createDirectory = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(createDirectory)
|
||||||
{
|
{
|
||||||
std::string componentId = fileDefinitions.EmitComponentCreateFolder(
|
std::string componentId = fileDefinitions.EmitComponentCreateFolder(
|
||||||
directoryId, GenerateGUID());
|
directoryId, GenerateGUID(), directoryInstalledFile);
|
||||||
|
|
||||||
featureDefinitions.EmitComponentRef(componentId);
|
featureDefinitions.EmitComponentRef(componentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(emptyDirectory)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,9 @@ void cmWIXFilesSourceWriter::EmitUninstallShortcut(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder(
|
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 componentId =
|
||||||
std::string("CM_C_EMPTY_") + directoryId;
|
std::string("CM_C_EMPTY_") + directoryId;
|
||||||
@ -127,6 +129,12 @@ std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder(
|
|||||||
|
|
||||||
BeginElement("CreateFolder");
|
BeginElement("CreateFolder");
|
||||||
|
|
||||||
|
if(installedFile)
|
||||||
|
{
|
||||||
|
cmWIXAccessControlList acl(Logger, *installedFile, *this);
|
||||||
|
acl.Apply();
|
||||||
|
}
|
||||||
|
|
||||||
EndElement("CreateFolder");
|
EndElement("CreateFolder");
|
||||||
EndElement("Component");
|
EndElement("Component");
|
||||||
EndElement("DirectoryRef");
|
EndElement("DirectoryRef");
|
||||||
|
@ -47,7 +47,8 @@ public:
|
|||||||
|
|
||||||
std::string EmitComponentCreateFolder(
|
std::string EmitComponentCreateFolder(
|
||||||
std::string const& directoryId,
|
std::string const& directoryId,
|
||||||
std::string const& guid);
|
std::string const& guid,
|
||||||
|
cmInstalledFile const* installedFile);
|
||||||
|
|
||||||
std::string EmitComponentFile(
|
std::string EmitComponentFile(
|
||||||
std::string const& directoryId,
|
std::string const& directoryId,
|
||||||
|
@ -76,6 +76,13 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf,
|
|||||||
property.ValueExpressions.push_back(ge.Parse(value).release());
|
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(
|
bool cmInstalledFile::GetProperty(
|
||||||
const std::string& prop, std::string& value) const
|
const std::string& prop, std::string& value) const
|
||||||
|
@ -62,6 +62,8 @@ public:
|
|||||||
void AppendProperty(cmMakefile const* mf,
|
void AppendProperty(cmMakefile const* mf,
|
||||||
const std::string& prop, const char* value,bool asString=false);
|
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 GetProperty(const std::string& prop, std::string& value) const;
|
||||||
|
|
||||||
bool GetPropertyAsBool(const std::string& prop) const;
|
bool GetPropertyAsBool(const std::string& prop) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user