Jump to content
Sign in to follow this  
bkb

how to assign 2 paths

Recommended Posts

If anyone knows, could you tell me how to assign 2 paths to this directive?

I declared this path here at the beginning, but it only receives 1

 

[setup]

DefaultDirName=C:\mygame\TEST

 

[code]
   function InitializeSetup(): Boolean;
   begin         
if (FileExists(ExpandConstant('C:\mygame\TEST\install.exe'))) then
begin
Result := true;
end
else if (FileExists(ExpandConstant('D:\mygame\TEST\install.exe'))) then
begin
Result := true;
end
else
begin
Result := false;
end
end;

 

Share this post


Link to post
function InitializeSetup(): Boolean;
begin
  Result := FileExists(ExpandConstant('C:\mygame\TEST\install.exe'))
         or FileExists(ExpandConstant('D:\mygame\TEST\install.exe'));
end;

Not sure what you mean by "assign 2 paths to this directive".

Share this post


Link to post
6 hours ago, Lars Fosdal said:

  

    
          

Não tenho certeza do que você quer dizer com "atribuir 2 caminhos a esta diretiva".

I'm trying to send the path stored in (FileExists(ExpandConstant) to DefaultDirName

 

The script I made is like this, if the first if is not found, it checks the next one
but I just can't send the path to the DefaultDirName

 

 

 

 

 

 

 

 

Share this post


Link to post
18 hours ago, bkb said:

[setup]

DefaultDirName=C:\mygame\TEST

This is about Inno Setup?

And you pascal code is not about Delphi but Inno Setup script?

 

BTW here we are in:   Home\Delphi Questions and Answers\General Help\

 

Edited by Cristian Peța

Share this post


Link to post

I think it should work with #if. Not tested.

But you really want to install in that path?
 

[Setup]
#if FileExists('C:\mygame\TEST\install.exe')
  DefaultDirName=C:\mygame\TEST
#else
  DefaultDirName=D:\mygame\TEST
#endif

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×