summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-09-29 13:21:45 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-09-29 13:21:45 (GMT)
commita22570ea19904b08afae204f378c6f5febd7f534 (patch)
treee4ac7c14f49038c002e97927b63e3c9076b99e6c /Source
parentc38d9687caf34ce50a167b3187243b33a348ccb4 (diff)
parentd48c781fc2e637fd9605775f44f4360bec6a59d9 (diff)
downloadCMake-a22570ea19904b08afae204f378c6f5febd7f534.zip
CMake-a22570ea19904b08afae204f378c6f5febd7f534.tar.gz
CMake-a22570ea19904b08afae204f378c6f5febd7f534.tar.bz2
Merge topic 'wix-directory-permissions'
d48c781f CPackWiX: Extend CPACK_WIX_ACL to support directories
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx30
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.cxx10
-rw-r--r--Source/CPack/WiX/cmWIXFilesSourceWriter.h3
-rw-r--r--Source/cmInstalledFile.cxx7
-rw-r--r--Source/cmInstalledFile.h2
5 files changed, 47 insertions, 5 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index b221ab4..744280a 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -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;
}
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index 0ad5d0c..1adb06a 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -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");
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index 23ef561..b0a4af8 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -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,
diff --git a/Source/cmInstalledFile.cxx b/Source/cmInstalledFile.cxx
index 3483ecc..4b53752 100644
--- a/Source/cmInstalledFile.cxx
+++ b/Source/cmInstalledFile.cxx
@@ -77,6 +77,13 @@ void cmInstalledFile::AppendProperty(cmMakefile const* mf,
}
//----------------------------------------------------------------------------
+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
{
diff --git a/Source/cmInstalledFile.h b/Source/cmInstalledFile.h
index 0292cd1..7134a4e 100644
--- a/Source/cmInstalledFile.h
+++ b/Source/cmInstalledFile.h
@@ -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;