[AD] File selector patch

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


The file selector (src/fsel.c) has currently some flaws:

- it contains platform-dependent code surrounded by those ugly #ifdef
ALLEGRO_PLATFORM / #endif pairs, including low-level code like __dpmi_int()
calls for DOS,

- in order to retrieve the current working directory (if it is not passed a
directory to start from), it directly calls the POSIX getcwd() function,
while every port provides a _al_getdcwd() internal function (this leads to
funny things: the MacOS port defines getcwd() as a wrapper around
_al_getdcwd() !).


The attached patch is aimed at fixing the two flaws:

- it moves the platform-dependent code (that handles the drive letter) from
src/fsel.c to the corresponding platform-specific file and defines a new
_al_drive_exists() internal function. This function is actually only
implemented under DOS and Windows, like _al_getdrive().

- it lets the file selector use _al_getdcwd() instead of getcwd().


Tested under DOS, Windows and Linux.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx

Attachment: fsel_internal.zip
Description: Zip compressed data



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