From: ronaldo hideki yamada <r.yamada@uo...> - 2001-01-29 20:19:59
dta = _al_findfirst(name, attrib, dta_name, &dta_attrib);
how manipulate the field attrib, now the macport ignore this and returns all
directors and files only attribute returned in dta_attrib is FA_DIREC.
i should return ../ (parent directory) as first match?
On Sun, 28 Jan 2001, ronaldo hideki yamada wrote:
> dta = _al_findfirst(name, attrib, dta_name, &dta_attrib);
> how manipulate the field attrib, now the macport ignore this and returns all
> directors and files only attribute returned in dta_attrib is FA_DIREC.
> i should return ../ (parent directory) as first match?
No, first return '.' (current dir), then '..' (parent dir) and other
entries (both dirs and files). Of course, don't return '.' and '..' when
you're not asked to return directories. For some kind of example, see
src/libc.c functions _alemu_findfirst() and _alemu_findnext() - those are
functions emulating findfirst/findnext() on POSIX systems (which, IMHO,
MacOS is not - with exception to MacOS X).
In include/allegro/alconfig.h there is:
/* emulate the FA_* flags for platforms that don't already have them */
#define FA_RDONLY 1
#define FA_HIDDEN 2
#define FA_SYSTEM 4
#define FA_LABEL 8
#define FA_DIREC 16
#define FA_ARCH 32
These flags are not stated anywhere in the docs, only at the end of
description of for_each_file():
The file attribute may contain any of the FA_* flags from dir.h.
This is relict from old DOS-Allegro days (as well as
findfirst()/findnext() emulation). Docs should be more specific.
- entries with read only flag (unwritable by current user)
- hidden entries (hidden under normal circumstances)
- system file - DOS/WIN relict, don't know if another OS has it
- volume label - I'm pretty sure there is no other OS to have this kind of
- volume label is present only in root directory on FAT
- directory (including special '.' and '..' files)
- file marked to archive/archived (I didn't really ever know what is it
- DOS/WIN relict, don't know if another OS has it
Have a nice day.