Re: [AD] Some more features for platform-independent filesystem?

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


Not sure I like the idea of giving existing paths different meanings. 
What if the user types in a path? If a path is read from a non-allegro ini
file, the registry, etc.?


Why not use functions like:

int  al_get_number_of_drives(); /* returns 1 on *nix */
void al_get_drive_name(int no, char * name_buffer); /* name for drive 0 on
*nix would be / */


void al_get_home_directory(int *buffer); /* $HOME on *nix, program dir on
win */

void al_get_virtual_root_dir(int *buffer); /* / on *nix, "My Computer" on
win */

This will allow you to write system independent file selection code easily. 

I'm also not sure I like the idea of magically renaming files. I'd prefer
to ask allegro for the propper name of a rc / ini file. Say like this:

sprintf(filename, "%sallegro%s", al_get_ini_prefix(), al_get_ini_suffix());

al_get_ini_prefix() would return "." on unix boxes "" on win boxes. 
al_get_ini_suffix() would return "rc" on unix boxes ".ini" on win boxes.

You could alse write a wrapper function for the sprintf(), if needed.

This allows the user to access all file systems the same way, use the same
code to create "proper" ini files, and avoids problems since the native
paths are untouched.


Regards,

Lennart 
Lennart Steinke
Project Manager
User Interface Design GmbH * Teinacher Str. 38  * D-71634 Ludwigsburg
Tel. +49 (0) 7141 377 00-0
Fax  +49 (0) 7141 377 00-99

Munich Subsidary:
User Interface Design GmbH * Lehrer-Götz-Weg 11 * D-81825 München


Get more information on the web:


http://www.uidesign.de


http://www.uidesign.de/serviceinfo/industry.html


http://www.praevention-online.de



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