-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeforge.iss
More file actions
143 lines (129 loc) · 4.73 KB
/
Copy pathcodeforge.iss
File metadata and controls
143 lines (129 loc) · 4.73 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
; CodeForge Windows installer (Inno Setup 6+)
; Built from the portable VSCode-win32-x64 folder produced by gulp vscode-win32-x64.
;
; Compile via: node scripts/build-installer-windows.mjs
; Or: ISCC.exe build/windows/codeforge.iss
#ifndef AppVersion
#define AppVersion "0.1.0"
#endif
#ifndef SourceDir
#define SourceDir "..\..\VSCode-win32-x64"
#endif
#ifndef OutputDir
#define OutputDir "..\..\dist\codeforge-win32-x64"
#endif
#define MyAppName "CodeForge"
#define MyAppPublisher "Kortexio"
#define MyAppURL "https://github.com/Kortexio/CodeForge"
#define MyAppExeName "CodeForge.exe"
#define MyAppId "{{F8A2A20C-72B3-11EC-90D6-0242AC120003}"
[Setup]
AppId={#MyAppId}
AppName={#MyAppName}
AppVersion={#AppVersion}
AppVerName={#MyAppName} {#AppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}/issues
AppUpdatesURL={#MyAppURL}/releases
DefaultDirName={localappdata}\Programs\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=..\..\LICENSE
OutputDir={#OutputDir}
OutputBaseFilename=CodeForge-Setup-{#AppVersion}-win32-x64
SetupIconFile={#SourceDir}\resources\app\resources\win32\code.ico
UninstallDisplayIcon={app}\{#MyAppExeName}
Compression=lzma2/ultra64
SolidCompression=yes
WizardStyle=modern
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
CloseApplications=yes
RestartApplications=no
ChangesAssociations=yes
ChangesEnvironment=yes
VersionInfoVersion={#AppVersion}.0
VersionInfoCompany={#MyAppPublisher}
VersionInfoDescription={#MyAppName} Setup
VersionInfoProductName={#MyAppName}
MinVersion=10.0
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "addtopath"; Description: "Add CodeForge to PATH (codeforge command)"; GroupDescription: "System:"; Flags: checkedonce
[Files]
Source: "{#SourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Registry]
; URL protocol: codeforge://
Root: HKCU; Subkey: "Software\Classes\codeforge"; ValueType: string; ValueName: ""; ValueData: "URL:CodeForge Protocol"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\codeforge"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""
Root: HKCU; Subkey: "Software\Classes\codeforge\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
Root: HKCU; Subkey: "Software\Classes\codeforge\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" --open-url ""%1"""
[Code]
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_CURRENT_USER,
'Environment', 'Path', OrigPath) then
begin
Result := True;
exit;
end;
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
BinPath: string;
OrigPath: string;
begin
if CurStep = ssPostInstall then
begin
if WizardIsTaskSelected('addtopath') then
begin
BinPath := ExpandConstant('{app}\bin');
if NeedsAddPath(BinPath) then
begin
if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath) then
RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath + ';' + BinPath)
else
RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', BinPath);
end;
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
BinPath: string;
OrigPath: string;
P: Integer;
NewPath: string;
begin
if CurUninstallStep = usPostUninstall then
begin
BinPath := ExpandConstant('{app}\bin');
if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath) then
begin
P := Pos(';' + BinPath, ';' + OrigPath);
if P > 0 then
begin
NewPath := Copy(OrigPath, 1, P - 1) + Copy(OrigPath, P + Length(BinPath) + 1, MaxInt);
while (Length(NewPath) > 0) and (NewPath[1] = ';') do
Delete(NewPath, 1, 1);
RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', NewPath);
end;
end;
end;
end;
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#MyAppName}}"; Flags: nowait postinstall skipifsilent