Question

I have to make a Inno Setup script to write to the registry the {app} path with forward slashes instead of backslashes

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType:string; ValueName:"APP_HOME"; ValueData:"{app}"; Flags: preservestringtype

How to get {app} value with forward slashes (inno by default write it with backslashes)?

Was it helpful?

Solution

You have to make a custom function for a {code:} scripted constant, e.g. this way:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "APP_HOME"; ValueData: {code:GetRegistryData}; Flags: preservestringtype

[Code]
function GetRegistryData(Value: string): string;
begin
  Result := ExpandConstant('{app}');
  StringChangeEx(Result, '\', '/', True);
end;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top