Page 1 of 1

Finding default folder.

Posted: Fri Jun 29, 2012 1:47 pm
by omni
Roger,

We are trying to update our app to run under any method user happens to start. For years we have had a mapped drive and specific folder. We do not need or want to change the folder, but the mapped drive is at times a problem if users search for the exe and open using the long server path. We have changed it to also accept this, which works if opened in explorer using the DC_CurPath(). However, if a shortcut is created on the desktop the results is c:\users....., which obviously does not work.
Is there a command to see where the app is loaded on a shortcut, similar to the DC_CurPath(). Cannot find one that works, at least not so far. If not, then I guess we will have to load the long path in our ini startup file.

Thanks, and have a great 4th.

Fred
Omni

Re: Finding default folder.

Posted: Fri Jun 29, 2012 2:29 pm
by rdonnay
This will give you the path of the running application .Exe

Code: Select all

cPath := DC_Path(AppName(.t.))

Re: Finding default folder.

Posted: Fri Jun 29, 2012 5:00 pm
by Auge_Ohr
omni wrote:using the long server path
did you have " " ( Space ) in your Shortcut Path ?

perhaps you can use "Shortname" without " " (Space).

Code: Select all

FUNCTION GetShortFileName(cLongName)
LOCAL cShortName := space(255)
LOCAL nNameLen   := 1
   if empty(cLongName)
      return ('')
   else
      nNameLen := DllCall("Kernel32.DLL", DLL_STDCALL, "GetShortPathNameA", ;
                          cLongName, @cShortName, len(cShortName))
   endif
return (left(cShortName, nNameLen))