Added a registry entry 'Install_Dir' in either HKCU\Software\TuxPaint or

HKLM... depending on whether the user is restricted (or doing a current
user-only install) or is installing for all users.
Refactored some of the Booleans.
This commit is contained in:
John Popplewell 2005-07-23 00:53:30 +00:00
parent eac0ad61c0
commit e4fa495378

View file

@ -62,6 +62,10 @@ Name: "{code:MyGroupDir}\{cm:ProgramOnTheWeb,Tux Paint}"; Filename: "{app}\tuxpa
Name: "{code:MyGroupDir}\{cm:UninstallProgram,Tux Paint}"; Filename: "{uninstallexe}"; IconFilename: "{app}\data\images\tuxpaint-installer.ico"; Comment: "Remove Tux Paint" Name: "{code:MyGroupDir}\{cm:UninstallProgram,Tux Paint}"; Filename: "{uninstallexe}"; IconFilename: "{app}\data\images\tuxpaint-installer.ico"; Comment: "Remove Tux Paint"
Name: "{code:MyDesktopDir}\Tux Paint"; Filename: "{app}\tuxpaint.exe"; Tasks: desktopicon Name: "{code:MyDesktopDir}\Tux Paint"; Filename: "{app}\tuxpaint.exe"; Tasks: desktopicon
[Registry]
Root: HKLM; Subkey: "SOFTWARE\TuxPaint"; Flags: uninsdeletekey; ValueName: "Install_Dir"; ValueType: string; ValueData: "{app}"; Check: AllUsers;
Root: HKCU; Subkey: "SOFTWARE\TuxPaint"; Flags: uninsdeletekey; ValueName: "Install_Dir"; ValueType: string; ValueData: "{app}"; Check: ThisUserOnly;
[Run] [Run]
Filename: "{app}\docs\html\README.html"; Description: "View the README file"; Flags: postinstall shellexec Filename: "{app}\docs\html\README.html"; Description: "View the README file"; Flags: postinstall shellexec
Filename: "{app}\tuxpaint-config.exe"; Description: "{cm:LaunchProgram,Tux Paint Config}"; Flags: nowait postinstall skipifsilent Filename: "{app}\tuxpaint-config.exe"; Description: "{cm:LaunchProgram,Tux Paint Config}"; Flags: nowait postinstall skipifsilent
@ -95,12 +99,22 @@ begin
Result := CheckListBox2.Checked[2] Result := CheckListBox2.Checked[2]
end; end;
function ThisUserOnly(): Boolean;
begin
Result := UsingWinNT() and (Restricted() or CurrentUserOnly())
end;
function AllUsers(): Boolean;
begin
Result := not ThisUserOnly()
end;
function MyAppDir(): String; function MyAppDir(): String;
var var
Path: String; Path: String;
begin begin
Path := ExpandConstant('{pf}') Path := ExpandConstant('{pf}')
if UsingWinNT() and (Restricted() or CurrentUserOnly()) then if ThisUserOnly() then
begin begin
Path := GetShellFolderByCSIDL(CSIDL_PROFILE, True); Path := GetShellFolderByCSIDL(CSIDL_PROFILE, True);
if Path = '' then if Path = '' then
@ -114,7 +128,7 @@ function MyGroupDir(Default: String): String;
var var
Path: String; Path: String;
begin begin
if Restricted() or CurrentUserOnly() then if ThisUserOnly() then
Path := ExpandConstant('{userprograms}') Path := ExpandConstant('{userprograms}')
else else
begin begin
@ -127,7 +141,7 @@ function MyDesktopDir(Default: String): String;
var var
Path: String; Path: String;
begin begin
if Restricted() or CurrentUserOnly() then if ThisUserOnly() then
Path := ExpandConstant('{userdesktop}') Path := ExpandConstant('{userdesktop}')
else else
begin begin
@ -139,11 +153,11 @@ end;
procedure CreateTheWizardPages; procedure CreateTheWizardPages;
var var
Page: TWizardPage; Page: TWizardPage;
Enabled, AllUsers: Boolean; Enabled, InstallAllUsers: Boolean;
begin begin
Page := CreateCustomPage(wpLicense, 'Choose Installation Type', 'Who do you want to be able to use this program?'); Page := CreateCustomPage(wpLicense, 'Choose Installation Type', 'Who do you want to be able to use this program?');
Enabled := NotRestricted() and UsingWinNT(); Enabled := NotRestricted() and UsingWinNT();
AllUsers := NotRestricted() and UsingWinNT(); InstallAllUsers := NotRestricted() and UsingWinNT();
CheckListBox2 := TNewCheckListBox.Create(Page); CheckListBox2 := TNewCheckListBox.Create(Page);
CheckListBox2.Width := Page.SurfaceWidth; CheckListBox2.Width := Page.SurfaceWidth;
CheckListBox2.Height := ScaleY(97); CheckListBox2.Height := ScaleY(97);
@ -154,8 +168,8 @@ begin
CheckListBox2.WantTabs := True; CheckListBox2.WantTabs := True;
CheckListBox2.Parent := Page.Surface; CheckListBox2.Parent := Page.Surface;
CheckListBox2.AddGroup('Installation Type:', '', 0, nil); CheckListBox2.AddGroup('Installation Type:', '', 0, nil);
CheckListBox2.AddRadioButton('All Users', '', 0, AllUsers, Enabled, nil); CheckListBox2.AddRadioButton('All Users', '', 0, InstallAllUsers, Enabled, nil);
CheckListBox2.AddRadioButton('Current User Only', '', 0, not AllUsers, True, nil); CheckListBox2.AddRadioButton('Current User Only', '', 0, not InstallAllUsers, True, nil);
end; end;
procedure CurPageChanged(CurPageID: Integer); procedure CurPageChanged(CurPageID: Integer);