Re: [AD] Finding the current directory path

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


On 2008-12-13, Colin Ward <lists@xxxxxxxxxx> wrote:
> Hi all.
> 
> I have a small but oft recurring problem with my Allegro port, which is to
> do with the current directory.
> 
> Often this is assumed by Allegro to be "./" which works on Unix and I
> believe also on Windows.  However, on the Amiga this doesn't work - the
> current directory is simply "".  So trying to open a file such as
> "./allegro.cfg" will fail.
> 
> I have changed a couple of files in Allegro to strip out this ./ prefix for
> now, but I was wondering if anyone had any suggestions on how to do this
> more generically.  Is there any actual need for Allegro to use ./ even on
> Unix?  A good example of this is in file.c:pack_fopen_chunk() on line 1987
> where it has the comment:
> 
> /* Give up - try current directory */
> 
> Any reason why it strdup()'s "./" and not ""?

Yes, in this case the string "/XXXXXX" is appended to tmp_dir.  The
result would be "/XXXXXX" rather than "./XXXXXX", which would try to
produce a temporary file in the root directory rather than the current
directory.

If you fix it properly, we can accept patches that avoid using "./".

Peter





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