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.?
>

What if it's done like this, with the colon not removed:

/C:/allegro

There would still persist most of the problems mentioned, but at least
there would be no confusion with an already existing directory name.

>
> 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 / */

I'm afraid of linux people not caring about this, decreasing portability
of their software. I saw at least one utility written with Allegro already
where I could only save on the current drive in windows, but which worked
in linux. Otherwise, that would solve my original problem with the needed
#ifdefs of course.

> 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 */

Windows does have that? What would you do in DOS? It's exactly what I'd like
to have, but Allegro would have to emulate it on platforms where it doesn't
exist (some(?) Windows versions and DOS).

> 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.

Maybe also add this for unix compatibility:

al_get_global_config_directory()

Which would return the global config path (no idea what it would be, but i
remember there was talk about this recently in one of the mailing lists or
allegro.cc).

or maybe even al_get_string("global_config_directory");

--
Elias Pschernig



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