1
- ; Script generated by the Inno Setup Script Wizard.
2
- ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3
- ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
4
- ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
5
- [SETUP]
1
+ ; --- Setup ---
2
+ [Setup]
6
3
AppId = {{cc9a344d-66b1-4f2d-844e-0b939cf31959}
7
4
AppName = Oobee Desktop
8
5
AppVersion = 0.10 .0
@@ -11,42 +8,101 @@ AppPublisher=GovTech
11
8
AppPublisherURL = https://github.com/GovTechSG/oobee-desktop
12
9
AppSupportURL = https://github.com/GovTechSG/oobee-desktop
13
10
AppUpdatesURL = https://github.com/GovTechSG/oobee-desktop
14
- DefaultDirName = C:\Program Files \Oobee Desktop
11
+
12
+ ; Never force UAC; Program Files only if launched elevated
13
+ PrivilegesRequired = lowest
14
+ PrivilegesRequiredOverridesAllowed= dialog
15
15
DisableDirPage = yes
16
- ChangesAssociations = yes
17
- DisableProgramGroupPage = yes
18
- ; LicenseFile=Oobee-win32-x64\LICENSE
19
- ; Uncomment the following line to run in non administrative install mode (install for current user only.)
20
- ;PrivilegesRequired=lowest
16
+ DefaultDirName = {code:GetDefaultDir}
17
+
21
18
Compression = lzma
22
19
SolidCompression = yes
23
20
WizardStyle = modern
21
+ ChangesAssociations = yes
24
22
25
23
[Languages]
26
24
Name : " english" ; MessagesFile : " compiler:Default.isl"
27
25
26
+ ; --- Tasks ---
28
27
[Tasks]
29
28
Name : " desktopicon" ; Description : " {cm:CreateDesktopIcon}" ; GroupDescription: " {cm:AdditionalIcons}" ; Flags : unchecked
30
29
30
+ ; --- Files (use \\?\ for long-path-safe copy) ---
31
31
[Files]
32
32
Source : " Oobee-win32-x64\*" ; DestDir : " \\?\{app} \Oobee Frontend" ; Flags : ignoreversion recursesubdirs createallsubdirs
33
33
Source : " D:\a\Oobee Backend\*" ; DestDir : " \\?\{app} \Oobee Backend" ; Flags : ignoreversion recursesubdirs createallsubdirs
34
- Source : " Install-WMIC.ps1" ; DestDir : " \\?\{app} " ; Flags : ignoreversion
35
- ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
34
+ ; Source: "Install-WMIC.ps1"; DestDir: "\\?\{app}"; Flags: ignoreversion
36
35
36
+ ; --- Shortcuts (both reflect "(User)" when not elevated) ---
37
37
[Icons]
38
- Name : " {autoprograms}\Oobee Desktop " ; Filename : " C:\Program Files\Oobee Desktop \Oobee Frontend\Oobee.exe"
39
- Name : " {autodesktop}\Oobee Desktop " ; Filename : " C:\Program Files\ Oobee Desktop\Oobee Frontend\Oobee.exe" ; Tasks: desktopicon
38
+ Name : " {autoprograms}\{code:GetShortcutName} " ; Filename : " {app} \Oobee Frontend\Oobee.exe"
39
+ Name : " {autodesktop}\{code:GetShortcutName} " ; Filename : " {app} \ Oobee Frontend\Oobee.exe"
40
40
41
+ ; --- Optional post-install (guard if needs admin; NO \\?\ here) ---
41
42
[Run]
42
- ; Filename: "C:\Program Files\Oobee\Oobee Frontend\Oobee.exe"; Description: "{cm:LaunchProgram,Oobee Desktop}"; Flags: nowait postinstall skipifsilent
43
- ; Add WMIC installation before running your application
44
- Filename : " powershell.exe" ; Parameters : " -ExecutionPolicy Bypass -File " " C:\Program Files\Oobee Desktop\Install-WMIC.ps1" " " ; Description : " {cm:LaunchProgram,Install required Windows features}" ; Flags : postinstall waituntilterminated
43
+ ; Filename: "powershell.exe"; Parameters: "-ExecutionPolicy Bypass -File ""{app}\Install-WMIC.ps1"""
44
+ ; Flags: postinstall waituntilterminated; Check: IsAdmin
45
45
46
+ ; --- Clean up (use \\?\ so delete handles long paths too) ---
46
47
[UninstallDelete]
47
- Type : filesandordirs ; Name : " C:\Program Files\Oobee \Oobee Frontend"
48
- Type : filesandordirs ; Name : " C:\Program Files\Oobee \Oobee Backend"
48
+ Type : filesandordirs ; Name : " \\?\ {app} \Oobee Frontend"
49
+ Type : filesandordirs ; Name : " \\?\ {app} \Oobee Backend"
49
50
50
51
[InstallDelete]
51
- Type : filesandordirs ; Name : " C:\Program Files\Oobee\Oobee Frontend"
52
- Type : filesandordirs ; Name : " C:\Program Files\Oobee\Oobee Backend"
52
+ Type : filesandordirs ; Name : " \\?\{app} \Oobee Frontend"
53
+ Type : filesandordirs ; Name : " \\?\{app} \Oobee Backend"
54
+
55
+ ; --- Code: choose base dir based on elevation ---
56
+ [Code]
57
+ const
58
+ AppIdUninstallKey = ' {cc9a344d-66b1-4f2d-844e-0b939cf31959}_is1' ;
59
+
60
+ function MachineInstallExists (): Boolean;
61
+ begin
62
+ Result :=
63
+ RegKeyExists(HKLM64, ' Software\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIdUninstallKey) or
64
+ RegKeyExists(HKLM, ' Software\Microsoft\Windows\CurrentVersion\Uninstall\' + AppIdUninstallKey);
65
+ end ;
66
+
67
+ function InitializeSetup (): Boolean;
68
+ var
69
+ Choice: Integer;
70
+ begin
71
+ // If there is an existing per-machine install and we're not elevated,
72
+ // inform the user and offer only user-mode install or exit.
73
+ if (not IsAdmin) and MachineInstallExists() then
74
+ begin
75
+ Choice := MsgBox(
76
+ ' A system-wide installation of Oobee Desktop already exists.' #13 #10 #13 #10 +
77
+ ' Without administrator rights, this setup will install a separate copy for your user only.' #13 #10 +
78
+ ' Shortcuts will be named "Oobee Desktop (User)".' #13 #10 #13 #10 +
79
+ ' Click "Yes" to proceed with user-only installation (recommended),' #13 #10 +
80
+ ' or "No" to cancel the installation.' ,
81
+ mbConfirmation, MB_YESNO);
82
+
83
+ if Choice = IDNO then
84
+ begin
85
+ Result := False; // Close installer
86
+ exit;
87
+ end ;
88
+ // If "Yes", fall through and proceed with per-user install
89
+ end ;
90
+
91
+ Result := True;
92
+ end ;
93
+
94
+ function GetDefaultDir (Param: string): string;
95
+ begin
96
+ if IsAdmin then
97
+ Result := ExpandConstant(' {autopf}\Oobee Desktop' ) // Program Files (admin)
98
+ else
99
+ Result := ExpandConstant(' {userappdata}\Oobee Desktop' ); // AppData\Roaming (per-user)
100
+ end ;
101
+
102
+ function GetShortcutName (Param: string): string;
103
+ begin
104
+ if IsAdmin then
105
+ Result := ' Oobee Desktop'
106
+ else
107
+ Result := ' Oobee Desktop (User)' ;
108
+ end ;
0 commit comments