Pregunta

I would like to create a desktop shortcup with inno Setup. I don't know what i must add into the configuration file of inno Setup to create my custom target.

Here is the line that i want to use :

"%userprofile%\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --app=file://%userprofile%/Desktop/web/index.html --disable-web-security

And here is the content of the script configuration file of inno Setup :

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Icons]
Name: "{commondesktop}\SDK"; Filename: "{app}\index.html"; WorkingDir: "{app}"; IconFilename: {app}\tools\favicon.ico; Tasks: desktopicon
¿Fue útil?

Solución

To specify icon parameters there's the Parameters parameter available for [Icons] section entries. The rest remains same as you already used. Just two notes; replace those environment variables by the corresponding path constants given by the Inno Setup scripting engine and be careful when using those variables when you're going to expand a file name with forward slashes (file://%userprofile%/..). Wouldn't such command line parameter fail in app. because it expands the path with baskslashes ?

In this script both mentioned issues should be considered:

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

[Icons]
Name: "{commondesktop}\SDK"; Filename: "{localappdata}\Google\Chrome SxS\Application\chrome.exe"; Parameters: "{code:GetParameters}"

[Code]
function ForwardSlashes(const Value: string): string;
begin
  Result := Value;
  StringChangeEx(Result, '\', '/', True);
end;

function GetParameters(Value: string): string;
var
  S: string;
begin
  S := ForwardSlashes(ExpandConstant('file://{userdesktop}/web/index.html'));
  Result := Format('--app=%s --disable-web-security', [S]);
end;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top