Hi,
just trying to get a config file to load.
Here's the bit of code which calls the load function :
/**********************************************************************/ /**************** Section : load configuration file. ******************/ /**********************************************************************/ config_manager.load_config_file("configuration/tpos_configuration_file.cfg", log); if(config_manager.init_okay() != GREEN_FLAG) { /* add clear up code */ return 0; }
Here's the class with the load function :
Here's the log file :
MESSAGE : 0 : Log file opened MESSAGE : 1 : Initialised Allegro System. MESSAGE : 2 : Initialised true type font addon. MESSAGE : 3 : Finished initialising InitialisationClass. MESSAGE : 4 : Initialising Primes_Manager class. MESSAGE : 5 : Initialised PhysFS successfully. MESSAGE : 6 : Initialising Display. MESSAGE : 7 : Unable to load font SIRCLIVE.ttf. MESSAGE : 8 : Successfully initialised the Display. MESSAGE : 9 : About to load configuration file (configuration/tpos_configuration_file.cfg). MESSAGE : 10 : Failed to load it.
Here's my directory structure (for some evidence so you've something to go on) :
https://www.allegro.cc/files/attachment/609444
{"name":"609444","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/c\/fc0677891bf25af8316192bc2ff131f7.png","w":400,"h":256,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/c\/fc0677891bf25af8316192bc2ff131f7"}
{"name":"609445","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/d\/2d4eeb6dbf45968c2460959871e262c4.png","w":400,"h":149,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/2\/d\/2d4eeb6dbf45968c2460959871e262c4"}
Any allegro code detectives fancy helping me work out why the cfg file won't load??
Windows uses
folder\myfoler
*NIX uses:
folder/subfolder
So for windows you would write "folder\\myfolder" in the c string (two \\ = one because you're escaping the first backslash, IIRC)
Cheers Chris
It's Allegro he's passing the string to, and it understands both separators I believe. Windows does too. *nix is case-sensitive, but that doesn't look like the problem either.
You can try posting your cfg file and we can look at it and try loading it ourselves, because your tpos_001 exe is in the directory above your config file, and so it looks like it should work. Oh yeah, please stop hiding your file name extensions, and attach the full size image next time, it's too hard to read.
It's Allegro he's passing the string to, and it understands both separators I believe. Windows does too. *nix is case-sensitive, but that doesn't look like the problem either.
You sure about that? I'm pretty sure I've had (back)slashes, and "./subdirectory/file" vs /subdirectory/file" (no dot) both cause me problems in A4 and A5 before.
Otherwise, why would this exist?
char *fix_filename_slashes(char *path);
I always use forward slahes on Windows and never had problems with this before. Most native Windows C and C++ functions should treat / and \\ equally for pathes.
I'm pretty sure I've had (back)slashes, and "./subdirectory/file" vs /subdirectory/file" (no dot) both cause me problems in A4 and A5 before.
The problem here, I believe, is that any path starting with a / is interpreted as an absolute path on Unix. Using "subdirectory/file" should work on all systems and represent a relative path.