1

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
wawanopoulos
  • 9,614
  • 31
  • 111
  • 166
  • Are you sure you want to expect on user's computer side by side Chrome installation ? Don't you rather [`want to determine the Chrome executable`](http://stackoverflow.com/a/22538486/960757) ? – TLama Mar 25 '14 at 10:41
  • It can be a second step, but for now, i would like to know how can i do to call chrome + link + extension flag – wawanopoulos Mar 25 '14 at 10:45
  • Ok thanks you. And, what can i do to be able to set the home directory of a user ? – wawanopoulos Mar 25 '14 at 11:03
  • Err, sorry, but which home directory ? Could you ask this separately, if possible ? If you mean working directory, then there is the `WorkingDir` parameter which you've already used... – TLama Mar 25 '14 at 11:35
  • In fact, i talked about the home directory of the user like : C:/Users/theUser – wawanopoulos Mar 25 '14 at 11:37
  • Ah, I see. Well, as far as I know, there is no constant for the user's profile folder root path (no constant that would return `%userprofile%` environment variable). There are [`constants`](http://www.jrsoftware.org/ishelp/topic_consts.htm) for all necessary subfolders of user's profile root folder and so it's probably because no one usually needs to know that :-) – TLama Mar 25 '14 at 11:46

1 Answers1

1

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;
TLama
  • 75,147
  • 17
  • 214
  • 392