Merge topic 'wix-read-only'

44a7543 CPackWiX: transfer file read only flag during installation
This commit is contained in:
Brad King 2014-01-02 14:24:13 -05:00 committed by CMake Topic Stage
commit 2da175ce9d
1 changed files with 11 additions and 0 deletions

View File

@ -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");