cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ralphster
Level 6

When displaying dialog SdAskDestPath, the directory path is incorrect.

Jump to solution

When run my Setup.rul file opens the SdAskDestPath dialog box with a default path showng next to the Browse button. So how do I get that directory path to default to the directory from which I am running the installation from? In other words where my Setup.exe is being run from? This was working when I would build my release from the menu option "Build | Build Release 1". However now if I build the release through the Release wizard, and then run the installation executable, the default path shown for SdAskDestPath dialog is some long path in the "C:\Users\..." directory. I need it to default to the directory from which my released setup.exe is being executed from. Below is my current code which is using SRCDIR. 

Dlg_SdAskDestPath:
szTitle = "Command File Path";
szDir =SRCDIR;
szgMessage="Please select the directory :";
nResult= SdAskDestPath(szTitle,szMsg,szDir,0);

 

 

 

When displaying dialog SdAskDestPath,

Labels (1)
0 Kudos
(1) Solution
banna_k
Revenera
Revenera

Hi @ralphster ,

 

 If you are using installscript MSI, then you can get the path from SETUPEXEDIR property as below:

nBufferSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SETUPEXEDIR", strTest, nBufferSize);

or if it is an Installscript project you can get  from the PACKAGE_LOCATION 

strTest = PACKAGE_LOCATION;

View solution in original post

(4) Replies
banna_k
Revenera
Revenera

Hi @ralphster ,

 

 If you are using installscript MSI, then you can get the path from SETUPEXEDIR property as below:

nBufferSize = MAX_PATH;
MsiGetProperty(ISMSI_HANDLE, "SETUPEXEDIR", strTest, nBufferSize);

or if it is an Installscript project you can get  from the PACKAGE_LOCATION 

strTest = PACKAGE_LOCATION;

Hi Banna,

Can you please help me some more? I am using an InstallScript Project. Will PACKAGE_LOCATION work with an InstallScript project?
I tried using PACKAGE_LOCATION and the value just comes back as an empty string.

 

string dirPath;

dirPath=PACKAGE_LOCATION ; // comes back as an empty string
I also tried:
ParsePath(dirPath,PACKAGE_LOCATION,FILENAME) // Still comes back with an empty string
I also tried displaying the path with a message box, but it is still empty.
MessageBoxEx("The location is : ",dirPatch,MB_OK);

 

Finally I tried using MsiGetProperty but get a compiler message of undefined identifier MsiGetProperty.
I also have the appropriate header #include "ifx.h", but still it does not recognize MsiGetProperty command.

MsiGetProperty(ISMSI_HANDLE,"SETUPEXEDIR",strTest,nBufferSize);

 

0 Kudos

Hello @ralphster ,

have you solved your problem ?

Just asking, because you can use the windows api (GetModuleFileNameEx and/or GetCommandLine) to get the paths you want.

Let me know if you need further assistance.

regards

Markus 

Hi Markus,

Yes I had marked Bannah's reply as the solution. Thanks for your advice as well.

 

Ralp

0 Kudos