Page 1 of 1

Application Path function?

Posted: Tue Feb 18, 2014 1:08 am
by Chipp
A few years ago I stumbled upon an application path function. I believe it was part of an undocumented native call. Anyone know what it was/is?

Filename is not it. I'm trying to call the pathname from a stack OUTSIDE the standalone. TIA.

Re: Application Path function?

Posted: Tue Feb 18, 2014 7:12 pm
by Chipp
Believe it or not-- I actually DREAMED the answer last night:

get the address

Re: Application Path function?

Posted: Tue Feb 18, 2014 7:52 pm
by FourthWorld
The address is reasonably useful in standalones on Mac and Win but not so much on Linux, and not useful at all if you need a similar path during development, since in the IDE it'll give you the path to LC rather than your mainstack. :(

Ken and I got into the habit of setting a global during init with the short name of the executable's mainstack, so we can use that as a reference point for any folder locations relative to the app, or any properties or other resources in the app's stack file.

Sure, it means an extra line of code, but the upside is well worth it, since we have one value we can use to obtain the same info in both development and at runtime.

e.g.:

Code: Select all

global gAppStack

function AppPath
   put the filename of stack gAppStack into tPath
   set the itemdel to "/"
   delete last item of tPath
   if the platform is "MacOS" then -- delete bundle stuff:
      delete item -2 to -1 of tPath
   end if
   return tPath
end AppPath

Re: Application Path function?

Posted: Tue Feb 18, 2014 8:06 pm
by Chipp
Yeah, I used to do that as well. Now I have a *plethora* of standalone players-- each focused on different platforms-- which all download and 'play' the same stack. I just didn't want to go back and rebuild/test each standalone player (LAZY!)

the address works fine for me. I'm using it to find the location of the fonts which need to be installed for each desktop (mobile installs automatically).