[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`concat' a dir and a file (was: Strange `file-name-sans-extension' behav

From: Stefan Monnier
Subject: `concat' a dir and a file (was: Strange `file-name-sans-extension' behavior )
Date: Fri, 16 Aug 2002 13:17:32 -0400

>     > The directory it uses is the one that was in the argument file name.
>     > If it was valid there, it should be equally valid in the result.
>     > If it is not valid in the result, I guess it was not valid in
>     > the argument.
>     The problem is the slash you append to the directory if it doesn't
>     end in a slash.
> I don't see any code in file-name-sans-extension to append a slash to
> the directory name.  It gets the directory name with
> file-name-directory and uses it without further change.
> Where is the slash appended?

The `Subject:' had not been updated, so it was misleading.
The discussion is about whether or not we need a new function
that is like expand-file-name but does not necessarily return
an absolute file name.   Currently when you need to combine a
relative dir with a file name, you need to use
(concat (file-name-as-directory foo) bar), but the fact that `concat'
works for this is purely accidental (and might not even be always true
for currently supported systems, according to Eli).

I've sometimes tried to use
  (let ((default-directory nil)) (expand-file-name bar foo))
  (let ((default-directory "")) (expand-file-name bar foo))

but it prepends "/" or "./" to the result.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]