Program Executable Location

Ken Ray kray at sonsothunder.com
Thu Feb 6 10:55:01 EST 2003


Actually, it's even easier guys... in a standalone, "the directory" points
to the folder where the standalone is automatically. When you're developing
in Rev, though, "the directory" points to the location of the Revolution
application. Basically "the directory" points to the location where the
currently running interpreter resides, unless it is changed later by setting
the directory to somewhere else.

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/

----- Original Message -----
From: "Klaus Major" <klausimausi at mac.com>
To: <use-revolution at lists.runrev.com>
Sent: Thursday, February 06, 2003 6:21 AM
Subject: Re: Program Executable Location


> Hi Jez,
>
> > Can I access the location of the executable being run ? For example,
> > if I
> > create the standalone "C:\Program Files\MyApp\Myexe.exe" I want to
> > programmatically get the directory "C:\Program Files\MyApp" so that I
> > can
> > store some files underneath this. Also when running in browse mode I
> > would
> > like the same code to give me the location of the revolution
> > executable.
> >
> > I am aware that I can examine defaultFolder on startup (which does
> > indeed
> > give you the executable location) and store this in a global variable,
> > but
> > this does not work well when testing the app in browse mode, since if
> > it
> > executes the same code again by that time the defaultFolder will
> > probably
> > point to somewhere else. A more secure way of getting the executable
> > location would be preferable.
>
> you can use a li'l function like this:
>
> function where_am_i
>     get the effective filename of this stack
>     ### will deliver the complete path...
>
>     set the itemdel to "/"
>     delete item -1 of it
>     ### strip the name of the standalone/stack
>
>     return it & "/"
>     ## ready for use :-)
>     ## since in earlier days i used to forget the last "/"
>     ## i got used to append it immediately ;-)
> end where_am_i
>
> Is fast, elegant and free ;-)
>
> And will of course not touch the working directory/default folder.
>
> Hope that helps.
>
>
> Regards
>
> Klaus Major
> klausimausi at mac.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list