[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how having the basename of a file or directory
From: |
Stefan Monnier |
Subject: |
Re: how having the basename of a file or directory |
Date: |
Mon, 31 Jan 2011 14:53:53 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> (defun basename (fname)
> (if (or (file-directory-p fname)
> (string-match "/$" fname))
> (let ((dirname (directory-file-name fname)))
> (file-name-nondirectory dirname))
> (file-name-nondirectory fname)))
If, as Karl suggests, your point is that you want a `basename' function,
then maybe we could add such a function (I'm really not convinced it's
worth the trouble. Better would be to add a paragraph in the manual,
I think), but I still insist that the above definition is wrong.
It should be
(defun file-basename (file)
(file-name-nondirectory (directory-file-name file)))
-- Stefan
- how having the basename of a file or directory, (continued)
- how having the basename of a file or directory, Stephen J. Turnbull, 2011/01/31
- Re: how having the basename of a file or directory, Thierry Volpiatto, 2011/01/31
- Re: how having the basename of a file or directory, Andreas Schwab, 2011/01/31
- Re: how having the basename of a file or directory, Thierry Volpiatto, 2011/01/31
- Re: how having the basename of a file or directory, Andreas Schwab, 2011/01/31
- Re: how having the basename of a file or directory, Thierry Volpiatto, 2011/01/31
- Re: how having the basename of a file or directory, Andreas Schwab, 2011/01/31
- Re: how having the basename of a file or directory, Stefan Monnier, 2011/01/31
- Re: how having the basename of a file or directory, Thierry Volpiatto, 2011/01/31
- Re: how having the basename of a file or directory, Karl Fogel, 2011/01/31
- Re: how having the basename of a file or directory,
Stefan Monnier <=
- Re: how having the basename of a file or directory, Thierry Volpiatto, 2011/01/31