Re: [AD] Magic main in Windows

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Stepan Roh:
> In main() programmers write:

> #ifdef DATA_DIR
> add_user_resource_dir(DATA_DIR, DATA);
> #endif
> #ifdef STATE_DIR
> add_user_resource_dir(STATE_DIR, STATE);
> #endif

> Values of *_DIR are supplied by some config.h created during build 
> process on *nix and undefined on Windows.

The macro for single user variable game data should also be defined on Windows:

2000/XP: C:\Documents and Settings\USER\My Documents\My Games\PROGRAM
     9x: C:\My Documents\My Games\PROGRAM

(The "My Games" dir was introduced in Windows 2000 or XP, I think, but can be
created by the function if it doesn't exist.)


It would also be nice to have the macro for shared variable game data (

   2000/XP: C:\Documents and Settings\All Users\Shared Documents\Games\PROGRAM
98/98SE/Me: C:\WINDOWS\All Users\Games\PROGRAM

) but I don't think this is supported well enough, because:

1. I don't know if the "All Users" dir exists on Windows 95.

2. Getting a meaningful value out of CSIDL_COMMON_DOCUMENTS requires a DLL
that doesn't come with 98 by default (not sure about ME), and I still only got
a blank return value when I had made sure I had the required DLL (but that's
probably my fault).

3. Windows XP incorrectly returns "C:\Documents and Settings\All
Users\Documents\PROGRAM" (ie. "Documents" instead of "Shared Documents" - could
it be a problem with MinGW?).

Too bad, since I assume limited users can't save to C:\Program Files
hierarchy. Maybe not a real issue, though. (Oh, and I think I may have invented
the "Games" dir just to be more in line with "My Games". :))

There's documents out there that describe which paths one should use. Lots of
commercial games use the home dir these days, never seen any using the
"shared..." dir, though. Maybe because of the same problems I had.

--
Daniel Schlyder
http://bitblaze.com/





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/