Re: [AD] Clarifying and revising filesystem API

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


On 2009-04-15, Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> On Wed April 15 2009, Peter Wang wrote:

> > ## API: al_change_directory
> >
> > Changes the current working directory to 'path'.
> >
> > Returns true on success, false on error.
> >
> > *(Q) need to figure out what to do with this if there are multiple
> > filesystems in effect; which filesystem's version of the "current
> > directory" is changed?*
> 
> Theres also a concept as current drive in windows, so that fixes that.

I don't understand what you mean.

> > *(Q) need to consider if this should _actually_ change the process'
> > working directory when using stdio driver, or just change it logically*
> 
> Why bother storing our own current dir? the OS already provides it for us.

Well,

- It's backend dependent.  You might expect a behaviour one way or the
  other, and get it wrong because a different backend is in effect.
  Think libraries.

- Calls to chdir could interfere.  This sequence may or may not work.

    ALLEGRO_FS_ENTRY *fp = al_create_entry("relative/path");
    al_open_fs_entry(fp, "r");
    ...
    al_close_fs_entry(fp);
    ...
    chdir(...);			// somewhere unobvious?
    ...
    al_open_fs_entry(fp, "r");	// try to reopen the file

- Threads.

As I said, it's just a consideration.

> > ## API: al_get_path_separator
> >
> > *(Q) need to figure out what to do with this if there are multiple
> > filesystems in effect, each with potentially its own syntax*
> 
> Huh? I don't follow. Why would multiple file systems on a host have different 
> syntax? Besides the intention is for fshooks to follow unix file system 
> syntax, and convert back and forth if needed (inside the driver).

This function was in the wrong place then.  I thought it had to do with
virtual file systems but I see it just tells you what the host
filesystem uses.  We also have ALLEGRO_NATIVE_PATH_SEP.

Peter





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