Nils Guillermin
Nils Guillermin

Reputation: 1987

Inno Setup refuses to set permissions of some files

I am writing an Inno Setup script that needs to add/modify permissions to certain files. However, it is setting permissions on some files and not other. Relevant code:

[Files]
Source: "K:\user\Odin\Installer Files\C_Odin\*"; DestDir: "{sd}\Odin"; Flags: ignoreversion recursesubdirs createallsubdirs

// CODE OF INTEREST STARTS HERE
Source: "K:\user\Odin\Installer Files\C_Odin\PDOXUSRS.NET"; DestDir: "{sd}\Odin"; Permissions: users-modify
Source: "K:\user\Odin\Installer Files\Data\PDOXUSRS.NET"; DestDir: "{sd}\Odin\Data"; Permissions: users-modify
Source: "K:\user\Odin\Installer Files\Data\Users.DB"; DestDir: "{sd}\Odin\Data"; Permissions: users-modify

The permissions on the first file are set correctly, the second two are not. Any insight is greatly appreciated

Ran the setup executable with /LOG, found this in there.

2016-07-22 16:45:12.502   -- File entry --
2016-07-22 16:45:12.502   Dest filename: C:\Odin\WorkStn.cfg
2016-07-22 16:45:12.502   Time stamp of our file: 2016-07-22 16:19:28.000
2016-07-22 16:45:12.502   Dest file exists.
2016-07-22 16:45:12.502   Time stamp of existing file: 2016-07-22 16:19:28.000
2016-07-22 16:45:12.502   Version of our file: (none)
2016-07-22 16:45:12.518   Version of existing file: (none)
2016-07-22 16:45:12.518   Installing the file.
2016-07-22 16:45:12.518   Successfully installed the file.
2016-07-22 16:45:12.518   Setting permissions on file: C:\Odin\WorkStn.cfg
2016-07-22 16:45:12.518   -- File entry --
2016-07-22 16:45:12.518   Dest filename: C:\Odin\Data\PDOXUSRS.NET
2016-07-22 16:45:12.518   Time stamp of our file: 2016-07-22 12:04:28.000
2016-07-22 16:45:12.518   Installing the file.
2016-07-22 16:45:12.518   Creating directory: C:\Odin\Data
2016-07-22 16:45:12.518   Successfully installed the file.
2016-07-22 16:45:12.518   Setting permissions on file: C:\Odin\Data\PDOXUSRS.NET
2016-07-22 16:45:12.518   -- File entry --

Full log https://gist.github.com/nguillermin/d814a14f68db8ebba1720a3af2f42a54

Upvotes: 1

Views: 1080

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202088

The log file shows that both files are installed twice.

It's clear why the first file is installed twice. The first time by the wildcard entry, the second time by the explicit entry. The wildcard entry without the Permissions attribute is before the explicit entry with Permissions attribute, so the second installation with the permissions overwrite the first installation without permissions.

But you didn't show us the second entry that installs the problematic file. So we do not know what it is like, nor if it is before or after the entry with the Permissions attribute.


Anyway, note it's wrong to have two entries installing the same file.

It does not work like the two entries are somehow merged. The file is actually installed twice, and the attributes of the first entry are lost. You should exclude the file that have a specific entry from the wildcard entry like:

Source: "K:\user\Odin\Installer Files\C_Odin\*"; Excludes: "PDOXUSRS.NET"; \
    DestDir: "{sd}\Odin"; Flags: ignoreversion recursesubdirs createallsubdirs

Source: "K:\user\Odin\Installer Files\C_Odin\PDOXUSRS.NET"; \
    DestDir: "{sd}\Odin"; Permissions: users-modify

Upvotes: 1

Related Questions