Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Where do I put my .dat files?

This thread is locked; no one can reply to it. rss feed Print
Where do I put my .dat files?
DJLad16
Member #14,857
January 2013

I've recently added some .dat files to my game to store the coords of my enemies and coins, it all works fine when I'm working on it.
The problem is that the game bugs out when once I've installed it on my machine. I'm using advanced installer, and I'm not sure where to place the files. I've tried placing them where the game itself is, but that didn't work. It also didn't work placing the files where my sprites are. So where do I place them?
(Sorry if I'm not clear enough, I wasn't sure how to explain this)

StevenVI
Member #562
July 2000
avatar

If they're in the same place as your sprites, and the sprites load yet the data files do not, are you specifying the paths differently when loading them?

Make sure that your installer is setting the "working directory" for the app's shortcut to the same path that it is installed in. It looks like it's called "Start in" in Windows 7. Been a while since I even thought about that sort of thing. :P

__________________________________________________
Skoobalon Software
[ Lander! v2.5 ] [ Zonic the Hog v1.1 ] [ Raid 2 v1.0 ]

Dizzy Egg
Member #10,824
March 2009
avatar

Yeah, what Steven said!

Basically the folder where your game runs whilst you're working on it will probably be very different to the folder it runs in when you install it!

So you have to use a function to get the working directory as a string, so you can use something like this pseudo code load_dat_file(workingDirectory + "/datafiles/mydatfile.dat"). There is a way to do this using allegro, but I'm not going to tell you how, mainly because I can't remember ATM.

----------------------------------------------------
Please check out my songs:
https://soundcloud.com/dont-rob-the-machina

Neil Roy
Member #2,229
April 2002
avatar

Dizzy Egg said:

So you have to use a function to get the working directory as a string, so you can use something like this pseudo code load_dat_file(workingDirectory + "/datafiles/mydatfile.dat"). There is a way to do this using allegro, but I'm not going to tell you how, mainly because I can't remember ATM.

workingDirectory = al_get_current_directory();

---
“I love you too.” - last words of Wanda Roy

LennyLen
Member #5,313
December 2004
avatar

It's good to see you were able to get loading your data from a file working. Just in case you weren't aware - you don't have to use the .dat extension on your files. I just used that with the code I sent you to as an example.

Arthur Kalliokoski
Second in Command
February 2005
avatar

NiteHackr said:

al_get_current_directory()

Isn't the OP talking about Allegro 4?

They all watch too much MSNBC... they get ideas.

LennyLen
Member #5,313
December 2004
avatar

Isn't the OP talking about Allegro 4?

No.

Go to: