Re: [AD] Clarifying and revising filesystem API

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


On Thu April 16 2009, Peter Wang wrote:
> 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.

A person writing a program is going to have to know what stuff each library 
they are using, uses. I don't think we should cater to people mixing multiple 
libraries that all use different fshook backends. The idea is mainly to set 
and forget. You shouldn't have to change it once its set, you're app from then 
on should know how to deal with it.

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

Don't mix calls to different file apis ;)

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

I never clarified that part of the api in my own head even. It really is what 
the back end is expecting, as it is essentially the "native" format. They 
exist to tell the application and any libs what format the backend is 
expecting.

> Peter
>
>
> ---------------------------------------------------------------------------
>--- Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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