Вопрос

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)?

Это было полезно?

Решение

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;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top