[Gambas-user] App Path

Fabien Bodard abidoo.too at ...11...
Sat Jun 12 12:48:48 CEST 2004


Le samedi 12 Juin 2004 06:57, Philip A. Chapman a écrit :
> On Fri, 2004-06-11 at 23:19, Devin Hassan wrote:
> > Hello,
> > This is how I load my tiles.
> > e = "/home/Devlin/SlayerMap/Dungeon/0073.png"
> >
> > As e is the variable I use to display the tile.
> >
> > My question here is how can I load the tile from the App Dir?
> > like "/SlayerMap/Dungeon/0073.png"
>
> Devin,
>
> Application.Path will give you the application path as a string, so you
> could do something like:
>
> e = Application.Path + "/SlayerMap/Dungeon/0073.png"

concatain text with '&' keyword, 
and for another time i repeat, ... (lol) Gambas have a magic keyword : "&/"
Who add automatiquely, the '/' if it miss.

e = Application.Path &/ "SlayerMap/Dungeon/0073.png"

Fabien
>
> May I humbly suggest that you may want to think of using some type of
> variable rather than Application.Path.  Or better yet, a function which
> when given the name of the file returns the filename or a file pointer.
> You may not always want the pictures to reside in a subdirectory of the
> application directory and will be glad to have this somewhat
> centralized.  For instance, you may want to be able to install your
> game's executable in /usr/local/bin so that anyone can run it without
> having to modify their PATH environment variable.  If the special
> variable is set to Application.Path or the function internally
> references Application.Path, no harm done.  It's easier to change it
> later.




More information about the User mailing list