From 44a7543c530cad64c429e85c679c481ee587f929 Mon Sep 17 00:00:00 2001 From: Nils Gladitz Date: Thu, 26 Dec 2013 00:14:44 +0100 Subject: CPackWiX: transfer file read only flag during installation --- Source/CPack/WiX/cmCPackWIXGenerator.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 // for GUID generation +#include +#include + 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"); -- cgit v0.12