Re: [AD] [TODO] About findfirst

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


> It seems pretty simple to map struct _finddata_t to struct ffblk
> (not sure about `ff_date'), and "_findfirst" to "findfirst".  The
> issue is whether we really want to.

Its true the differences are trivial, but it still requires #ifdefs in the
users code which will break when a new platform is added.
There are 2 choices I can see

1) Have this info (with chmod info too) in a struct which is the same on
every platform, and guaranteed in future Allegro

2) Have a set of functions/macros to extract the data, as the data is
read-only for most uses.
e.g.
#ifdef _ALLEGRO_DJGPP_
#define al_findfile_name(ff) (ff->f_time);
#define al_findfile_created(ff) ( ((ff->date) <<16) | (ff->time) )
etc. which would join for_each_file in the API

Now I've typed this I think 2) would be slightly better myself, as the
al_findfirst would not have to slavishly translate the whole struct every
time it calls the underlying function.

Matt





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