PDA

Click to See Complete Forum and Search --> : how to not specify the location of a file, but still have it read


Charlezz
Jan 3rd, 2000, 06:34 AM
in my program i want to play sounds that would be in the same directory as my prog., but the user can just put the thing in any freakin file they want how the heck is my game gonna know where the sound is. like if i specify in my game that rollerrink.mid is in C:\program files\mygame\gamesounds\rollerrink.mid, but the user puts the game in D:\mycrap\games i got\crappy games then it all get jacked up!

badgers
Jan 3rd, 2000, 07:02 AM
you may be able to use app.path to find out where you game is. You can then find the folder relative to your game.
you need to make sure that the music folder is installed the same way relative to your app
ex
D:\program files\mygame contains the .exe
D:\program files\mygame\gamesounds contains the music
app.path will retrive the path regardless if it is G:\hi\how\are\you\mygame\


------------------
I am so skeptacle, I can hardly believe it!

Charlezz
Jan 3rd, 2000, 08:29 AM
Thanks man! I tried to do Me.path, but with no luck!

Jan 3rd, 2000, 10:01 AM
Here is an example I use in my code to load a picture for example from the same directory as my program.

example1.Picture = LoadPicture(App.Path + "\example.gif")

Then it doesn't matter what directory I put the program in.. It will read it from anywhere. :)

You can do the same if you add a SUB directory to your app..

example : C:\myprogram\images\example.gif

so you would write it this way..
example1.Picture = LoadPicture(App.Path + "\images\example.gif")

Hope this helps.. :)


------------------
John T. Mieske
Knight Vision Enterprises
kvision@gate.net