summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-01-02 19:24:13 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-01-02 19:24:13 (GMT)
commit2da175ce9d13ea4c16fdea1f808c1f661134ea05 (patch)
tree230ce81c637a41909bfc92441c2e59bc599b319b
parenta294ff08b775acc24e524503d078503104af52b5 (diff)
parent44a7543c530cad64c429e85c679c481ee587f929 (diff)
downloadCMake-2da175ce9d13ea4c16fdea1f808c1f661134ea05.zip
CMake-2da175ce9d13ea4c16fdea1f808c1f661134ea05.tar.gz
CMake-2da175ce9d13ea4c16fdea1f808c1f661134ea05.tar.bz2
Merge topic 'wix-read-only'
44a7543 CPackWiX: transfer file read only flag during installation
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index c1749ac..78e7339 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -27,6 +27,9 @@
#include <rpc.h> // for GUID generation
+#include <sys/types.h>
+#include <sys/stat.h>
+
int cmCPackWIXGenerator::InitializeInternal()
{
componentPackageMethod = ONE_PACKAGE;
@@ -920,6 +923,14 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
fileDefinitions.AddAttribute("Source", fullPath);
fileDefinitions.AddAttribute("KeyPath", "yes");
+ mode_t fileMode = 0;
+ cmSystemTools::GetPermissions(fullPath.c_str(), fileMode);
+
+ if(!(fileMode & S_IWRITE))
+ {
+ fileDefinitions.AddAttribute("ReadOnly", "yes");
+ }
+
ApplyPatchFragment(fileId, fileDefinitions);
fileDefinitions.EndElement("File");