Jerome
Jerome

Reputation: 23

Inno Setup Use a part of an application path for an icon path

I need to insert the last part of the installation dirrectory in the icon name.

To do that I'm trying to use ExtractFileName({app}), and insert its result in the Name parameter of my icon.

[Icons]
Name: '{group}\ApplicationName\' + ExtractFileName({app}) + '\filename.txt' 

It compiles, but at runtime I get a 123 error, telling that

c:\Windows\system32\'c: could not be created.

I just need to insert the basename of the installation path as a new level in start menu.

Upvotes: 1

Views: 355

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202534

You are looking for a scripted constant.

[Icons]
Name: "{group}\ApplicationName\{code:GetAppName}\filename.txt"

[Code]

function GetAppName(Param: string): string;
begin
  Result := ExtractFileName(ExpandConstant('{app}'));
end;

Upvotes: 1

Related Questions