Repository navigation
Expand file tree
/
Copy pathinstaller.iss
More file actions
144 lines (134 loc) · 5.38 KB
/
Copy pathinstaller.iss
File metadata and controls
144 lines (134 loc) · 5.38 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
144
; Inno Setup Script for OpenNotes (legacy namespace/data identity remains Caelum)
; This creates a proper Windows installer with Start Menu shortcuts,
; Program Files installation, and an uninstaller.
#ifndef MyAppName
#define MyAppName "OpenNotes"
#endif
#ifndef MyAppVersion
#define MyAppVersion "5.2.15"
#endif
#ifndef MyAppPublisher
#define MyAppPublisher "Learnmore_smart"
#endif
#ifndef MyAppURL
#define MyAppURL "https://github.com/Learnmore-smart/OpenNotes"
#endif
#ifndef MyAppExeName
#define MyAppExeName "OpenNotes.exe"
#endif
#ifndef MyAppSourceDir
; Payload directory staged by the CI publish step. The WPF job publishes
; to .\publish (default); the WinUI/V6 job publishes to .\publish-winui
; and invokes ISCC with
; /DMyAppSourceDir=publish-winui /DMyAppExeName=OpenNotes.WinUI.exe
; /DMyAppWinUIPayload
#define MyAppSourceDir "publish"
#endif
#ifndef MyAppOutputBaseFilename
#define MyAppOutputBaseFilename "OpenNotes-Setup-" + MyAppVersion
#endif
[Setup]
AppId={{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}/issues
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=LICENSE
OutputDir=installer_output
OutputBaseFilename={#MyAppOutputBaseFilename}
SetupIconFile=Assets\app-icon.ico
Compression=lzma2/ultra64
SolidCompression=yes
WizardStyle=modern
ArchitecturesInstallIn64BitMode=x64compatible
ArchitecturesAllowed=x64compatible
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
UninstallDisplayIcon={app}\{#MyAppExeName}
MinVersion=10.0
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "startmenu"; Description: "Create a Start Menu shortcut"; GroupDescription: "{cm:AdditionalIcons}"
[Files]
; Install all published files (WPF: publish\*, WinUI/V6: publish-winui\* —
; both are self-contained single-folder outputs including pdfium.dll).
Source: "{#MyAppSourceDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
#ifdef MyAppWinUIPayload
[InstallDelete]
; Same AppId + install dir means a V6 setup upgrades a 5.x (WPF) install
; in place. Sweep the stale WPF payload so only OpenNotes.WinUI.exe remains.
; InstallDelete runs before [Files] extraction, so sweeping *.dll/*.pdb is
; safe — the new payload re-extracts every shared dependency.
Type: files; Name: "{app}\*.dll"
Type: files; Name: "{app}\*.pdb"
Type: files; Name: "{app}\OpenNotes.exe"
Type: files; Name: "{app}\OpenNotes.deps.json"
Type: files; Name: "{app}\OpenNotes.runtimeconfig.json"
#endif
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
[Code]
// T13-H hotfix: repair stale "OpenNotes" shortcuts left behind by 5.x
// (WPF) installs. A 5.x link targets {app}\OpenNotes.exe, which the WinUI
// payload no longer installs — the dead link shows a blank generic icon
// and won't launch. The 5.x installer could also have written shortcuts
// into the common (all-users) desktop/Start Menu while this install runs
// per-user (PrivilegesRequired=lowest), and [Icons] only rewrites this
// install's own {auto*} scope, so stale copies can survive in the other
// scope's folders.
//
// Inno can't read a .lnk's target, so use the removed exe as the proxy:
// once {app}\OpenNotes.exe is gone, every "OpenNotes.lnk" on disk either
// predates the new exe layout (stale -> repair) or was just written by
// [Icons] against {#MyAppExeName} (delete + recreate is an identical
// no-op). With the WPF payload OpenNotes.exe exists, so nothing runs.
procedure CurStepChanged(CurStep: TSetupStep);
var
ShortcutDirs: array[0..4] of String;
AppDir, ExePath, LnkPath: String;
I: Integer;
begin
if CurStep <> ssPostInstall then
Exit;
AppDir := ExpandConstant('{app}');
if FileExists(AppDir + '\OpenNotes.exe') then
Exit;
ShortcutDirs[0] := ExpandConstant('{userdesktop}');
ShortcutDirs[1] := ExpandConstant('{commondesktop}');
ShortcutDirs[2] := ExpandConstant('{userprograms}');
ShortcutDirs[3] := ExpandConstant('{commonprograms}');
// Pinned taskbar links live in the per-user Quick Launch store. The dir
// may not exist — FileExists on a .lnk inside it safely returns false.
ShortcutDirs[4] := ExpandConstant('{userappdata}') +
'\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar';
ExePath := AppDir + '\{#MyAppExeName}';
for I := 0 to 4 do
begin
LnkPath := ShortcutDirs[I] + '\{#MyAppName}.lnk';
if FileExists(LnkPath) then
begin
DeleteFile(LnkPath);
// CreateShellLink raises on failure (e.g. a common-scope link under
// a per-user install); log it and move on — worst case the stale
// link remains, no worse than before this fix.
try
CreateShellLink(LnkPath, '', ExePath, '', AppDir, ExePath, 0,
SW_SHOWNORMAL);
except
Log('OpenNotes setup: could not repair shortcut ' + LnkPath);
end;
end;
end;
end;