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 14, 2008, Matthew Leverton wrote:
> > 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.
>
> Both Windows XP and Vista have application folders and user data
> folders that can be queried. Is this part of the Allegro API
> documented somewhere? I was looking for them when creating the hiscore
> file for the a5 version of Speed but couldn't find it.
>
> Basically, the most helpful way is for it to work like:
>
> al_set_path_app_name("Speed"); // implicitly creates the app data
> folder if it doesn't exist.
>
> al_get_system_folder(ALLEGRO_APP_DATA_PATH);
>
> On Vista, it might return:
>
> c:\users\All Users\Application Data\Speed\
>
> al_get_system_filename(ALLEGRO_APP_DATA_PATH, "hiscores");
>
> c:\users\All Users\Application Data\Speed\hiscores
>
> al_get_system_filename(ALLEGRO_USER_DATA_PATH, "hiscores");
>
> c:\users\Matthew\Application Data\Speed\hiscores

Thats pretty much what AL_PATH and al_get_path allow, and I wanted to add a 
al_set_appname(), but no one ever said anything about it one way or the other.

simple example:
char buffer[512];
al_get_path(AL_USER_DATA_PATH, buffer, 512);

you can either use regular string handling to append anything to it you like, 
or look into the AL_PATH api to mangle it.

AL_PATH *path = al_path_create(buffer);
al_path_append(path, "hiscores");

al_path_to_string(path, buffer, 512, ALLEGRO_NATIVE_PATH_SEP);

Sorry I don't have docs yet for fshook.h and path.h. I hope to get it done 
soon.

> --
> Matthew Leverton
>
> ---------------------------------------------------------------------------
>--- 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/