How to automatically replace a special character in the installation path on Inno Setup?

Viewed 28

I am making a mod for a game. My problem is that in the windows registry the path of the game has a character that is different from the path that it should be.

Windows Registry:

D:\SteamLibrary\steamapps\common[NINJA GAIDEN Master Collection] NINJA GAIDEN Σ

Correct path:

D:\SteamLibrary\steamapps\common[NINJA GAIDEN Master Collection] NINJA GAIDEN Σ

[Setup]
DefaultDirName={code:GetInstallationPath}


[Code]
var
  InstallationPath: string;

function GetInstallationPath(Param: string): string;
begin
  { Detected path is cached, as this gets called multiple times }
  if InstallationPath = '' then
  begin
    if RegQueryStringValue(
         HKLM64, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Steam App 1580780',
         'InstallLocation', InstallationPath) then
    begin
      Log('Detected Steam installation: ' + InstallationPath);
    end
      else
    begin
      InstallationPath := 'C:\games';
      Log('No installation detected, using the default path: ' + InstallationPath);
    end;
  end;
  Result := InstallationPath;
end;

How do I make it for Inno Setup replace the wrong symbol in the installation path?

"...[NINJA GAIDEN Master Collection] NINJA GAIDEN Σ"

to

"...[NINJA GAIDEN Master Collection] NINJA GAIDEN Σ"

0 Answers
Related