[Gambas-user] App Path

Philip A. Chapman pchapman at ...129...
Sat Jun 12 06:57:54 CEST 2004


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"

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.

-- 
Philip A. Chapman

Application Development:
Java, Visual Basic (MCP), PostgreSQL, MySQL, MSSQL
Linux, Windows 9x, Windows NT, Windows 2000, Windows XP
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20040611/2e3263e7/attachment.sig>


More information about the User mailing list