Added macros for the registry keys.

This commit is contained in:
John Popplewell 2005-07-28 00:29:26 +00:00
parent d67643c1ae
commit bdbfc53779

View file

@ -12,6 +12,8 @@
#define AppName "Tux Paint" #define AppName "Tux Paint"
#define AppDirName "TuxPaint" #define AppDirName "TuxPaint"
#define AppPrefix "tuxpaint" #define AppPrefix "tuxpaint"
#define AppRegKey AppDirName
#define AppRegValue "Install_Dir"
#define AppGroupName AppName #define AppGroupName AppName
#define AppExe AppPrefix+".exe" #define AppExe AppPrefix+".exe"
@ -88,8 +90,8 @@ Name: "{code:MyGroupDir}\{#AppGroupName}\{cm:UninstallProgram,{#AppName}}"; File
Name: "{code:MyDesktopDir}\{#AppName}"; Filename: "{app}\{#AppExe}"; Tasks: desktopicon Name: "{code:MyDesktopDir}\{#AppName}"; Filename: "{app}\{#AppExe}"; Tasks: desktopicon
[Registry] [Registry]
Root: HKLM; Subkey: "SOFTWARE\{#AppDirName}"; Flags: uninsdeletekey; ValueName: "Install_Dir"; ValueType: string; ValueData: "{app}"; Check: AllUsers; Root: HKLM; Subkey: "SOFTWARE\{#AppRegKey}"; Flags: uninsdeletekey; ValueName: "{#AppRegValue}"; ValueType: string; ValueData: "{app}"; Check: AllUsers;
Root: HKCU; Subkey: "SOFTWARE\{#AppDirName}"; Flags: uninsdeletekey; ValueName: "Install_Dir"; ValueType: string; ValueData: "{app}"; Check: ThisUserOnly; Root: HKCU; Subkey: "SOFTWARE\{#AppRegKey}"; Flags: uninsdeletekey; ValueName: "{#AppRegValue}"; ValueType: string; ValueData: "{app}"; Check: ThisUserOnly;
[Run] [Run]
Filename: "{app}\{#AppReadme}"; Description: "View the README file"; Flags: postinstall shellexec Filename: "{app}\{#AppReadme}"; Description: "View the README file"; Flags: postinstall shellexec
@ -138,10 +140,10 @@ function MyAppDir(): String;
var var
Path: String; Path: String;
begin begin
Path := ExpandConstant('{reg:HKLM\SOFTWARE\{#AppDirName},Install_Dir|{pf}\{#AppDirName}}'); Path := ExpandConstant('{reg:HKLM\SOFTWARE\{#AppRegKey},{#AppRegValue}|{pf}\{#AppDirName}}');
if ThisUserOnly() then if ThisUserOnly() then
begin begin
Path := ExpandConstant('{reg:HKCU\SOFTWARE\{#AppDirName},Install_Dir|__MissingKey__}'); Path := ExpandConstant('{reg:HKCU\SOFTWARE\{#AppRegKey},{#AppRegValue}|__MissingKey__}');
if Path = '__MissingKey__' then if Path = '__MissingKey__' then
begin begin
Path := GetShellFolderByCSIDL(CSIDL_PROFILE, True); Path := GetShellFolderByCSIDL(CSIDL_PROFILE, True);