From jan@swi.psy.uva.nl Wed Apr 11 10:44:50 2001
Received: from gollem.swi.psy.uva.nl (root@gollem [145.18.152.30])
	by swi.psy.uva.nl (8.11.2/8.11.2) with ESMTP id f3B8io311436;
	Wed, 11 Apr 2001 10:44:50 +0200 (MET DST)
Received: from localhost (localhost [[UNIX: localhost]])
	by gollem.swi.psy.uva.nl (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) id f3B8inP30829;
	Wed, 11 Apr 2001 10:44:49 +0200
From: Jan Wielemaker <jan@swi.psy.uva.nl>
Organization: SWI, University of Amsterdam
To: Nicos Angelopoulos <nicos@soi.city.ac.uk>, prolog@swi.psy.uva.nl
Subject: Re: [SWIPL] absolute_file_name/2
Date: Wed, 11 Apr 2001 10:39:19 +0200
X-Mailer: KMail [version 1.0.29.2]
Content-Type: text/plain
References: <Pine.GSO.4.02A.10104101729180.20270-100000@altair.soi.city.ac.uk>
In-Reply-To: <Pine.GSO.4.02A.10104101729180.20270-100000@altair.soi.city.ac.uk>
MIME-Version: 1.0
Message-Id: <01041110444901.22631@gollem>
Content-Transfer-Encoding: 8bit

On Tue, 10 Apr 2001, Nicos Angelopoulos wrote:
>Hello, 
>
>i am using SWI on linux, (2 different machines 2 different pl versiona, 
>                          one is 4.0.2)
>
>when i do (e.g. on 4.0.2)
>
>?- absolute_file_name('~', A ).
>
>i get 
>
>A = '/usr/nicos/pl/~' ;
>
>(where /usr/nicos/pl is my pwd at typing % pl) 
>
>
>is there something wrong with my installations, 
>or i am just misreading the manual ?
>or is it Linux specific problem ?
>
>does anybody get anything more sensible on a different OS ?

I was almost trapped too, but the answer is correct. 
absolute_file_name/2 doesn't treat any character except for / (and \ and
the start sequence drive: on windows) special.  Hence it expands to the
absolute-path for a file named ~ in the current directory.

What you are looking for is expand_file_name(+Spec, -ListOfExpansions)
that handles ~, $var, *, ? and {...}, expanding to a list of matching
files.

This has been changed (see ChangeLog) rather long ago as especially on
windows names tend to have ~ and $ all over the place, leading to weird
results and errors.

	--- Jan

