Re: [AD] About findfirst (2) |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> I'm ok to do the work minus the MacOS stuff.
The (big) patch is located at:
http://www.multimania.com/ebotcazou/dev/findfirst.zip
What has changed:
- the DOS (src/dos/dfile.c) and Windows (src/win/wfile.c) ports both use
POSIX stat() to implement the file_size() and file_time() functions. POSIX
platforms (src/misc/ufile.c) already use stat() and hopefully MacOS will
soon do the same.
- _al_findfirst(), _al_findnext() and _al_findclose() have lost their
underscore and become part of the API. From allegro.h:
struct al_ffblk /* file info block for the al_find*() routines */
{
int attrib; /* actual attributes of the file found */
time_t time; /* modification time of file */
long size; /* size of file */
char name[1024]; /* name of file */
void *ff_data; /* private hook */
};
AL_FUNC(int, al_findfirst, (AL_CONST char *pattern, struct al_ffblk *info,
int attrib));
AL_FUNC(int, al_findnext, (struct al_ffblk *info));
AL_FUNC(void, al_findclose, (struct al_ffblk *info));
- _al_file_exists() has gone away: for each port, it was implemented by
using the platform-dependent version of findfirst(). Now that there is an
unified version of this routine [the new al_findfirst()], file_exists()
directly calls it.
- design schema:
API level for_each_file(), file_exits()
|
abstraction layer al_findfirst(), al_findnext(), al_findclose()
|
platform-dep level findfirst(), findnext(), findclose() for DJGPP
_findfirst(), _findnext(), _findclose() for Win
opendir(), readdir(), closedir() for POSIX
Tested under DOS (djgpp) and Windows (MinGW).
However, since I don't have Linux here, I only tested the POSIX code under
djgpp. Therefore I'll wait for a test on some true POSIX platform (either
by me or by anyone else) before applying the patch.
The main test I used is located at:
http://www.multimania.com/ebotcazou/dev/faviewer.zip
Btw, since src/misc/ufile.c is used by Unixes as well as non-Unixes (BeOS
and QNX), what about renaming it into pfile.c (i.e POSIX files) ?
---
Eric Botcazou
ebotcazou@xxxxxxxxxx