Skip to content

Commit f08019b

Browse files
committed
Do not reset themes and config on update, but allow it if wanted
1 parent 88d1c5d commit f08019b

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

tools/windows-installer/turing-system-monitor.iss

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,51 @@ Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
6161
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
6262
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
6363

64+
[Types]
65+
Name: "default"; Description: "Default installation"; Flags: iscustom
66+
67+
[Components]
68+
Name: "program"; Description: "Turing System Monitor software"; Flags: fixed; Types: default
69+
Name: "themes"; Description: "Default themes (local changes will be lost! - custom themes are preserved)"; Types: default
70+
Name: "config"; Description: "Default configuration"; Types: default
71+
6472
[Files]
65-
Source: "{#SourceDir}*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
73+
Source: "{#SourceDir}*"; Excludes: "config.yaml,themes"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: program
74+
Source: "{#SourceDir}config.yaml"; DestDir: "{app}"; Flags: ignoreversion; Components: config
75+
Source: "{#SourceDir}res\themes\*"; Excludes: "--Theme examples"; DestDir: "{app}\res\themes\"; Flags: ignoreversion recursesubdirs; Components: themes
6676
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
6777

6878
[Icons]
6979
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
7080
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
7181
Name: "{group}\Turing System Monitor"; Filename: "{app}\configure.exe"
7282

83+
[Code]
84+
function IsUpgrade: Boolean;
85+
var
86+
Value: string;
87+
UninstallKey: string;
88+
begin
89+
UninstallKey := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\' +
90+
ExpandConstant('{#SetupSetting("AppId")}') + '_is1';
91+
Result := (RegQueryStringValue(HKLM, UninstallKey, 'UninstallString', Value) or
92+
RegQueryStringValue(HKCU, UninstallKey, 'UninstallString', Value)) and (Value <> '');
93+
end;
94+
95+
(* Skip components page when first installation: install all components *)
96+
function ShouldSkipPage(PageID: Integer): Boolean;
97+
begin
98+
Result := (PageID = wpSelectComponents) and not IsUpgrade;
99+
end;
73100
101+
procedure InitializeWizard;
102+
begin
103+
if IsUpgrade then begin
104+
Log('Upgrade detected');
105+
WizardSelectComponents('program !themes, !config');
106+
end
107+
else begin
108+
Log('First installation');
109+
WizardSelectComponents('program themes config');
110+
end;
111+
end;

0 commit comments

Comments
 (0)