-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.iss
More file actions
81 lines (73 loc) · 2.57 KB
/
setup.iss
File metadata and controls
81 lines (73 loc) · 2.57 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
; ==========================================================
; EverMod CLI — Windows Installer (Inno Setup 6)
; ==========================================================
; Creates a clean CLI installation with PATH registration.
; ==========================================================
[Setup]
AppName=EverMod CLI
AppId={{E1A0ADEF-01D4-4A2F-8B77-5C7A77B8D5E4}}
AppVersion=2.0.0
AppPublisher=WipoDev
AppPublisherURL=https://github.com/wipodev/evermod-cli
AppSupportURL=https://github.com/wipodev/evermod-cli/issues
AppUpdatesURL=https://github.com/wipodev/evermod-templates
DefaultDirName={autopf}\EverMod CLI
OutputBaseFilename=EverMod-Setup
SetupIconFile=assets\installer.ico
UninstallDisplayIcon={app}evermod.exe
Compression=lzma
SolidCompression=yes
WizardStyle=modern
LicenseFile=LICENSE
PrivilegesRequired=lowest
DisableProgramGroupPage=yes
DisableDirPage=no
DisableReadyMemo=no
ArchitecturesInstallIn64BitMode=x64compatible
[Files]
Source: "dist\evermod.exe"; DestDir: "{app}"; Flags: ignoreversion
[Registry]
; ✅ Add EverMod CLI to user PATH (HKCU → no requiere admin)
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; \
ValueData: "{olddata};{app}"; Flags: preservestringtype
[Run]
; ✅ Update PATH immediately (optional)
Filename: "powershell.exe"; \
Parameters: "-Command ""[Environment]::SetEnvironmentVariable('Path', ($env:Path + ';{app}'), 'User')"""; \
Flags: runhidden
; ✅ Install templates only if ~/.evermod does not exist
Filename: "{app}\evermod.exe"; \
Parameters: "update --force --silent"; \
Flags: runhidden; \
Check: not EvermodTemplatesExist
[Code]
function EvermodTemplatesExist(): Boolean;
var
TemplatesPath: String;
begin
TemplatesPath := ExpandConstant('{%USERPROFILE}\.evermod');
Result := DirExists(TemplatesPath);
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
PathValue, AppDir, TemplatesPath: String;
begin
if CurUninstallStep = usUninstall then
begin
{ ✅ 1. Clean PATH }
AppDir := ExpandConstant('{app}');
RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', PathValue);
if Pos(AppDir, PathValue) > 0 then
begin
StringChangeEx(PathValue, ';' + AppDir, '', True);
StringChangeEx(PathValue, AppDir, '', True);
RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', PathValue);
end;
{ ✅ 2. Remove .evermod folder from user directory }
TemplatesPath := ExpandConstant('{%USERPROFILE}\.evermod');
if DirExists(TemplatesPath) then
begin
DelTree(TemplatesPath, True, True, True);
end;
end;
end;