[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Path Operations: Concatenation (concat), Extraction of sub-paths, et
From: |
Kai Grossjohann |
Subject: |
Re: Path Operations: Concatenation (concat), Extraction of sub-paths, etc. |
Date: |
Fri, 27 Apr 2007 08:47:24 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux) |
Nordlöw <per.nordlow@gmail.com> writes:
> - concatenation of paths: (path-concat "/usr/" "/lib") => "/usr/lib/"
Not exactly, but close: expand-file-name
> - extraction of sub-paths: (path-before "/usr/lib/" "/lib/") => "usr/"
Not exactly, but close, perhaps: file-name-directory,
file-name-nondirectory.
> - extraction of sub-paths: (path-after "/usr/lib/X11" "lib") => "X11/"
See above.
> - full path to local file name: (path-local "/etc/passwd") => "passwd"
file-name-nondirectory
> - full path to containing directory path: (path-dir "/etc/passwd") =>
> "/etc/"
file-name-directory
> If possible results should be standardized/canonicalized, that is
> - directories always end with "/"
file-name-as-directory
> - non-absolute paths always begin directly with the top-most directory
> name without the "/"
Hm. There must be a function to strip leading "./" and "/./" in the
middle, but I don't know what it is. There is file-truename which
might do this as a side effect.
Kai