Re: [AD] exists under Unix |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Peter Wang <tjaden@xxxxxxxxxx> writes:
> Under Unix I think `exists' should use the FA_HIDDEN flag, so that files
> such as ~/.allegrorc can be found.
Why? What's the logic for the Unix version working differently to on all
other platforms?
For flexible calls, the file_exists() function is the generic way to do this
kind of test. The exists() routine was added as a shortcut because people
were often just doing a file_exists(filename, FA_ARCH | FA_RDONLY, NULL),
but if you want to include hidden files, you can just call file_exists()
yourself and pass it the hidden flag.
Unless there is a particularly good reason for this, I'm reluctant to just
arbitrarily make the Unix version work differently to on DOS and Windows.
Yes, Unix filesystem semantics are totally different to Microsoft OS's, but
if you really want to do sensible things with Unix files, you need to call
stat() in order to access the full set of file attributes. As long as people
are just writing basic portable code and trying to ignore those differences,
it seems to me that the closest mapping onto DOS/Windows behaviour is that
files beginning with a period are mapped onto the FA_HIDDEN flag...
--
Shawn Hargreaves - shawn@xxxxxxxxxx - http://www.talula.demon.co.uk/
"A binary is barely software: it's more like hardware on a floppy disk."