Код:
function GetInstallationPath(Param: string): string;
begin
{ Detected path is cached, as this gets called multiple times }
if InstallationPath = '' then
begin
if RegQueryStringValue(
HKLM32, 'SOFTWARE\GOG.com\Games\1196955511',
'path', InstallationPath) then
begin
Log('Detected GOG installation: ' + InstallationPath);
end
else
if IsWin64 then
if RegQueryStringValue(
HKLM64, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 475150',
'InstallLocation', InstallationPath) then
begin
Log('Detected Steam installation: ' + InstallationPath);
end
else
begin
InstallationPath := ExpandConstant('{pf}');
MsgBox('Не удалось автоматически определить где установлена игра. В ходе установки укажите путь вручную', mbInformation, MB_OK);
Log('No installation detected, using the default path: ' + InstallationPath);
end;
end;
Result := InstallationPath;
end;