Re: [AD] Additions for al_get_path() (was Re: Allegro 5 TODOs (from wiki))

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


On December 13, 2008, Evert Glebbeek wrote:
> On 9-Dec-08, at 11:25 PM, Thomas Fjellstrom wrote:
> > It needs AL_PATH_USER_SETTINGS and AL_PATH_SYSTEM_SETTINGS to be
> > added. IIRC
> > OSX doesn't want to place the settings for things in the same place,
> > and if we
> > ever do get a al_set_application_name(...) function, then the full
> > dir path
> > including the app name can be automatically included for the user.
> >
> > Its a simple addition, just add two new enum values to the enum, and
> > implement
> > as the specific platform expects.
>
> Preliminary patch attached (not thoroughly tested).
> I've made the following identifications:
>
> * OS X:
>    AL_USER_PATH_SETTINGS: $HOME/Library/Application Support/
>    AL_SYSTEM_PATH_SETTINGS: /Library/Application Support/
>
> * Linux/generic UNIX:
>    AL_USER_PATH_SETTINGS: $HOME/
>    AL_SYSTEM_PATH_SETTINGS: /etc/
>
> * Windows:
>    AL_USER_PATH_SETTINGS: same as AL_USER_DATA_PATH
>    AL_SYSTEM_PATH_SETTINGS: same as AL_SYSTEM_DATA_PATH
>
> The OS X ones I'm fairly certain are correct. I'm not so secure about
> the generic UNIX ones; my logic here was that global settings would go
> in /etc/namerc and user settings in ~/.namerc (or ~/.name/namerc),
> which I think is common but of course not reflected simply by the
> directory name. Of course, /etc/ should be something that can be set
> (at the very least) at configure time, just like /usr/share/ for
> AL_SYSTEM_DATA_PATH.

USER_SETTINGS is a little tricky on unix, things are starting to place user 
app config in ~/.config/appname* while a lot of apps still just use 
~/.appname*

> Windows doesn't seem to have the equivalent of a "settings" directory,
> probably because settings are supposed to go into the registry - which
> I'm guessing isn't addressable as a filesystem.
> Let me know what you think.

I think there might be a settings folder in the user's Profile directory some 
place. I think its new as of xp sp3 or some version of vista.

> Should I post the hard-coded value of /usr/share on the tracker?

all of the hard coded values in there should probably go. or at least add 
whatever is configured from cmake/etc to the list of hard coded items.

> Finally, I want to point out an inconsistency for the return value of
> al_get_path() between platforms in the case that the path cannot be
> retrieved (invalid enum or can't find it). On Windows, the current
> code always returns the "dir" parameter, which is "" in that case. On
> OS X and *nix, the return value is NULL. Which of these is correct?

I'm not sure. I suppose NULL is a good way to know if it fails.. Otherwise, if 
it returns null, someone might be using it, and not checking it which will 
cause a crash (ie: al_fs_fopen(al_get_path(...),"r")).

> Evert
>
> ---------------------------------------------------------------------------
>--- SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada. The future of the web can't happen without you.  Join us at MIX09
> to help pave the way to the Next Web now. Learn more and register at
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com
>/


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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