Inno setup - cannot grant admin-only access to files in sub-directories - inno-setup

I tried Inno setup script to allow some to files access only to admins only, but seems inno setups - permissions not working as expected. Permissions only applies to {app} folder only, not the sub-directories and files.
Below is the code fragment I used.
[Dirs]
Name: "{app}"; Permissions: users-readexec;
Name: "{app}\assets\shadowInstaller\app"; Permissions: users-readexec;
[Files]
; Service, Launcher, Killer Binaries
Source: "..\_Source\Bin\*"; DestDir: "{app}"; Flags: recursesubdirs ignoreversion; Permissions: users-readexec;
Source: "..\_Source\DirectFN\assets\shadowInstaller\app\*"; DestDir: "{app}\assets\shadowInstaller\app\"; Permissions: users-readexec;

Related

Inno Setup can't handle Source path with space

my application has this directory that I need to include in the install package:
bin\Win Files\*
So, in the [Files] section, I have this line:
Source: "bin\Win Files\*"; DestDir: "{app}\bin\Win Files"; Flags: ignoreversion; Permissions: everyone-modify
But at compile time, it keeps saying it can't find that directory due to space in the path, the exact error message is:
No files found matching "C:\dev\packages\MyApp\bin\Win Files\*"
I've tried the following, all failed:
Source: """bin\Win Files\*"""
Source: "\"bin\Win Files\*\""
Source: '"bin\Win Files\*"'
That directory has to be named like that, so what should I do?
I use this:
[Files]
; Main application
Source: "{#SourceDir}\*"; DestDir: "{app}\"; Flags: recursesubdirs ignoreversion;
to copy all my files in one go to the installer. Note the recursesubdirs flag. I think spaces in the path (referenced here in the variable named SourceDir) are not actually a problem here.
This is due to the misunderstanding about the directory/file structure scanning mechanism in Inno Setup.
First of all, as #Martin Prikryl pointed out, one can include path that has space in it.
I think the following two rules are the key to this issue:
One cannot specify a folder that has no standalone files (e.g. empty folder or a folder that only has sub-directories). In my case: I have the following file structure per this question:
bin\Win Files\Libs\
bin\Win Files\Plugins\
So Source: "bin\Win Files\*"; will fail. If there is at least one standalone file under the "bin\Win Files\" folder, then the source line will work.
Inno Setup requires each folder be explicitly specified in the [Files] section as below:
Source: "bin\Win Files\Libs\*"; DestDir: "{app}\bin\Win Files\Libs";
Flags: ignoreversion; Permissions: everyone-modify
Source: "bin\Win Files\Plugins\*"; DestDir: "{app}\bin\Win Files\Plugins";
Flags: ignoreversion; Permissions: everyone-modify
as Source: "bin\Win Files\*"; will NOT include the sub-directories automatically, it is only used to include the standalone files under the bin\Win Files\ folder.

Inno Setup - titles my setup as "My Setup", how to change this?

Here is my code: As you see I have given the name of my application, but still I get the title "My Setup" when I run it
[Setup]
AppName=Diabetis
AppVersion=0.9
DefaultDirName={pf}\Diabetis
DefaultGroupName=Diabetis
UninstallDisplayIcon={app}\Diabetis.exe
Compression=lzma2
SolidCompression=yes
OutputDir="C:\Users\nwsco\source\repos\Diabetis_sqllite\"
[Dirs]
Name: {app}; Permissions: users-full //to allow manipulating database
[Files]
Source: "C:\Users\nwsco\source\repos\Diabetis_sqllite\Diabetis\bin\Debug\Diabetis.exe"; DestDir: "{app}"
Source: "C:\Users\nwsco\source\repos\Diabetis_sqllite\Diabetis\bin\Debug\Diabetis.db"; DestDir: "{app}"
Source: "C:\Users\nwsco\source\repos\Diabetis_sqllite\Diabetis\bin\Debug\DSettings.db"; DestDir: "{app}"
Source: "C:\Users\nwsco\source\repos\Diabetis_sqllite\Diabetis\bin\Debug\Diabetis.pdb";
[Icons]
Name: "{group}\Diabetis"; Filename: "{app}\Diabetis.exe"
I solved my problem by adding:
OutputBaseFilename=Diabetis_Setup.exe
but now I have another problem, the program will display Diabetis_Setup.exe.exe, writing therefore twice the .exe.
I have tried also:
OutputBaseFilename=Diabetis_Setup
but it does not like it

Custom Disk Spanning in Inno Setup

Is there any way Components section based custom disk spanning?
For example:
[Components]
Name: "c1"; Description: "Component 1"
Name: "sc2"; Description: "Special Component 2"
Name: "redist"; Description: "Redistributables"
[Files]
Source: component.exe; DestDir: "{app}"; Components: c1
Source: "specialfolder\*"; DestDir: "{app}"; Components: sc2
Source: redist.msi; DestDir: "{app}"; Components: redist
The files that i want to see after compile: setup.exe, c1.bin, special.bin, redist.bin
Thanks.
No it is not possible.
If your intention was to allow user to get only the pieces he/she needs, you can use the extern flag and {src} source directory instead. Though this is not really disk spanning. But it would allow the user to have just the files needed for the installation along the setup.exe. If you really need to store the files on separate disks, you can implement a prompt for additional disks and an actual installation in Pascal script.

Inno Setup Make dirs and files read only

I'm new user in Inno Setup. My problem is that I have some folders and one file. I want to make a setup package to install all of them. Here is my code
[Files]
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "C:\POS CAD Standard"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "D:\POS CAD Standard\acad.lsp"; DestDir: "{userappdata}\Autodesk\AutoCAD 2014\R19.1\enu\support"; Flags: ignoreversion
[Dirs]
Name: "C:\POS CAD Standard"; Attribs:readonly hidden system; Permissions: users-readexec;Flags:
[Icons]
Name: "{group}\{cm:UninstallProgram,POS CAD Standard}"; Filename: "{uninstallexe}"
It works fine, but when I'm trying to setup to another PC my source file is not found, and I want to make some files (not folder) to be read only.
Use Attribs: readonly parameter.
It is supported both in the [Files] and [Dirs] sections.
Source: "D:\POS CAD Standard\CAD\*"; DestDir: "{sd}\POS CAD Standard"; \
Flags: ignoreversion recursesubdirs createallsubdirs; Attribs: readonly
Note that I've used the {sd} constant instead of hardcoding the C: drive (what is a bad practice).

Installing file in users AppData folder using inno-setup

I am using Inno-Setup version 5.5.3(a).
[Files]
Source: "C:\GPT\GPT.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\GPT\GPT.dat"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
I would like to install the "GPT.dat" file into the users AppData folder in a custom folder called "GPT"
e.g. AppData\GPT\
for example, in my delphi code, I create a folder called "GPT" in the users AppData path. These is where I would like to place the file
var
path: array[0..MAX_PATH] of char;
SHGetFolderPath(0, CSIDL_APPDATA, 0, SHGFP_TYPE_CURRENT, #path);
userPath:= Path;
UserPath:= UserPath + '\GPT\';
if not DirectoryExists(UserPath) then
CreateDir(UserPath);
Can anyone tell me how to edit my [Files] section of my Inno script to make this happen?
Thanks
You need to use the {userappdata} constant, which is mapped just to the CSIDL_APPDATA item ID, as a destination directory for your files:
[Files]
Source: "C:\GPT\GPT.dat"; DestDir: "{userappdata}\GPT\"; Flags: ignoreversion createallsubdirs recursesubdirs comparetimestamp
{userappdata} & {commonappdata}
The path to the Application Data folder.
CSIDL_APPDATA = {userappdata} = C:\Documents and Settings\username\Application Data
CSIDL_COMMON_APPDATA = {commonappdata} = C:\Documents and Settings\All Users\Application Data
You need to use : {userappdata}
If you check the Inno Setup documentation :
{userappdata} = C:\Documents and Settings\username\AppData\Roaming\
{commonappdata} = C:\Documents and Settings\All Users\AppData\Roaming\
{localappdata} : The path to the local (nonroaming) Application Data folder.
{userappdata} & {commonappdata} : The path to the Application Data folder.
I use :
[Files]
Source: MyPath\* ; Flags: recursesubdirs createallsubdirs; DestDir: {userappdata}\MySoftware\ ; Components: ConfigFiles
And my config files are in :
C:\Users*\AppData\Roaming\MySoftware**
It seems more appropriate to use {programdata}, if I interpret Mirals comment correctly.
However, on XP there is no {programdata}, only {commonappdata} or {userappdata}, so I have to diversify my install. {programdata} is a later invention.
A disturbing trap is when the desktop and userappdata are mirrored to the server ("roaming profile"), that slows programs down greatly if they use userappdata for ini file storage, at least that's my experience.

Resources