Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to get the shortpath?


1 reply to this topic

Malini

Malini
  • Members
  • 9 posts

Posted 23 January 2002 - 11:08

I have to change the long file path to short path.
If I hardcode that path then it is working fine.But I have to convert the long path of INSTALLDIR to shortpath.Using MsigetProperty i'm getting the INSTALLDIR value and passing it to the LongPathToShortpath function.But the function fails.Help me to solve this problem.

The code which i have used is which is not working is
f
unction Longtoshort(hMSI)
       STRING szDir,szBuffer,svPath,szMsg;
       NUMBER nBuffer,nResult;
       begin  
       nBuffer=256;
       MsiGetProperty(hMSI,"INSTALLDIR",szDir,nBuffer);
       nResult=LongPathToShortPath(szDir);
       end;
     
 But if i give it as

szDir="C:\\Program Files\\";
LongPathToShortPath(szDir);

It is working Fine.

Please Help...



Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 23 January 2002 - 19:08

The path must exist before you call the function. So if you call this before file copy, INSTALLDIR hasn't been created yet.
Are you doing this in a deferred custom action? Then you can't access the INSTALLDIR property directly. (Insert a MessageBox to see what's in szPath).