-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.iss
More file actions
121 lines (105 loc) · 4.85 KB
/
Setup.iss
File metadata and controls
121 lines (105 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
; ScreenshotSweeper Installer Script for Inno Setup
; Download Inno Setup from: https://jrsoftware.org/isdl.php
#define MyAppName "ScreenshotSweeper"
#define MyAppVersion "2.0.2"
#define MyAppPublisher "darshan-aids"
#define MyAppURL "https://github.com/rushdarshan/sweeper"
#define MyAppExeName "ScreenshotSweeper.exe"
[Setup]
; App Information
AppId={{8F7A3C2E-9B1D-4F5E-A8C7-2D4E6B9F1A3C}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputDir=Installer
OutputBaseFilename=ScreenshotSweeper-Setup-v{#MyAppVersion}
; Use the generated sweeper.ico for installer/exe icons
SetupIconFile=Resources\Icons\sweeper.ico
Compression=lzma2/max
SolidCompression=yes
WizardStyle=modern
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
ArchitecturesInstallIn64BitMode=x64
; Wizard Configuration
DisableProgramGroupPage=yes
DisableWelcomePage=no
; License and Info
LicenseFile=LICENSE.txt
InfoBeforeFile=InstallerInfo.rtf
; Uninstall
UninstallDisplayIcon={app}\{#MyAppExeName}
UninstallDisplayName={#MyAppName}
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
; Main application files
Source: "bin\Release\net8.0-windows10.0.19041.0\win-x64\publish\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; Include app icon files so shortcuts can reference them after install
Source: "Resources\Icons\sweeper.ico"; DestDir: "{app}\Resources\Icons"; Flags: ignoreversion
Source: "Resources\Icons\sweeper_16x16.png"; DestDir: "{app}\Resources\Icons"; Flags: ignoreversion
Source: "Resources\Icons\sweeper_32x32.png"; DestDir: "{app}\Resources\Icons"; Flags: ignoreversion
Source: "Resources\Icons\sweeper_48x48.png"; DestDir: "{app}\Resources\Icons"; Flags: ignoreversion
Source: "Resources\Icons\sweeper_64x64.png"; DestDir: "{app}\Resources\Icons"; Flags: ignoreversion
Source: "Resources\Icons\sweeper_128x128.png"; DestDir: "{app}\Resources\Icons"; Flags: ignoreversion
Source: "Resources\Icons\sweeper_256x256.png"; DestDir: "{app}\Resources\Icons"; Flags: ignoreversion
[Icons]
; Start Menu shortcut (all users via {group}, also user programs for better search indexing)
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\Resources\Icons\sweeper.ico"
Name: "{userprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\Resources\Icons\sweeper.ico"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: "{app}\Resources\Icons\sweeper.ico"; Tasks: desktopicon
[Registry]
; Auto-start at Windows login (per-user, no admin required)
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "{#MyAppName}"; ValueData: """{app}\{#MyAppExeName}"" --minimized"; Flags: uninsdeletevalue
[Run]
; Run setup wizard after installation to configure the app
Filename: "{app}\{#MyAppExeName}"; Parameters: "--setup"; Description: "Configure ScreenshotSweeper"; Flags: nowait postinstall
; Launch the app after setup wizard completes (optional)
Filename: "{app}\{#MyAppExeName}"; Parameters: "--minimized"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent unchecked
[Code]
function InitializeSetup(): Boolean;
var
ErrorCode: Integer;
DotNetInstalled: Boolean;
begin
Result := True;
// Check if .NET 8 Runtime is installed
DotNetInstalled := RegKeyExists(HKLM, 'SOFTWARE\dotnet\Setup\InstalledVersions\x64\sharedhost') or
RegKeyExists(HKLM, 'SOFTWARE\WOW6432Node\dotnet\Setup\InstalledVersions\x64\sharedhost');
if not DotNetInstalled then
begin
if MsgBox('.NET 8 Runtime is required but not installed.' + #13#10 + #13#10 +
'Would you like to download it now?', mbConfirmation, MB_YESNO) = IDYES then
begin
ShellExec('open', 'https://dotnet.microsoft.com/download/dotnet/8.0/runtime', '', '', SW_SHOW, ewNoWait, ErrorCode);
end;
Result := False;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
// Create AppData folder for config
CreateDir(ExpandConstant('{userappdata}\ScreenshotSweeper'));
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
if MsgBox('Do you want to remove application data and configuration files?', mbConfirmation, MB_YESNO) = IDYES then
begin
DelTree(ExpandConstant('{userappdata}\ScreenshotSweeper'), True, True, True);
end;
end;
end;