This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Can't find file in SUPPORTDIR
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 10, 2008
04:41 PM
Can't find file in SUPPORTDIR
I placed my file in support files / language independent. When I run the code below in a custom action I get my FindFile failed message box. Can anybody tell me what I am doing wrong?
#include "ifx.h"
export prototype MyFunction(HWND);
function MyFunction(hMSI)
STRING DllPath, svResult;
begin
DllPath = SUPPORTDIR^"CustomActionLibrary.dll";
MessageBox("Path to DLL: " + DllPath, INFORMATION);
if (FindFile(SUPPORTDIR, "CustomActionLibrary.dll", svResult) < 0) then
MessageBox ("FindFile failed.", SEVERE);
else
SprintfBox (INFORMATION, "FindFile Example", "Found: %s in %s.", svResult, SUPPORTDIR);
endif;
end;
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 10, 2008
06:06 PM
What type of project? You might try getting the value of the SUPPORTDIR property (using MsiGetProperty) instead of the SUPPORTDIR variable.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 11, 2008
08:13 AM
I am trying to implement this in a basic msi project. I changed my code to use MsiGetProperty and still get FindFile Failed. At runtime the file gets placed in a different temp directory than the one pointed to by SUPPORTDIR. The changes I made are shown below.
#include "ifx.h"
export prototype MyFunction(HWND);
function MyFunction(hMSI)
STRING DllPath, ClassName, Domain, supportDirPath;
STRING svToDll, svFromDll, svResult;
NUMBER nvSize;
OBJECT DotNetObj;
begin
nvSize = 256;
MsiGetProperty(hMSI, "SUPPORTDIR", supportDirPath, nvSize);
DllPath = supportDirPath^"CustomActionLibrary.dll";
MessageBox("Path to DLL: " + DllPath, INFORMATION);
if (FindFile(SUPPORTDIR, "CustomActionLibrary.dll", svResult) < 0) then
MessageBox ("FindFile failed.", SEVERE);
else
SprintfBox (INFORMATION, "FindFile Example", "Found: %s in %s.", svResult, SUPPORTDIR);
endif;
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 11, 2008
08:22 AM
Even though you retrieved the value of the SUPPORTDIR property, you used the SUPORTDIR variable in your FindFile call. Try changing the if statement from:
if (FindFile(SUPPORTDIR, "CustomActionLibrary.dll", svResult) < 0) then
to:
if (FindFile(supportDirPath, "CustomActionLibrary.dll", svResult) < 0) then
and see if that works better.
if (FindFile(SUPPORTDIR, "CustomActionLibrary.dll", svResult) < 0) then
to:
if (FindFile(supportDirPath, "CustomActionLibrary.dll", svResult) < 0) then
and see if that works better.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 11, 2008
08:50 AM
Thank you DanGalender, I knew that... That's what I get for trying to code before having coffee in the morning. So I made that change and it worked, is there a reason why just using SUPPORTDIR does not work?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 11, 2008
09:07 AM
The notes in the InstallShield help topic "SUPPORTDIR" have a bit more information about it.