1.0.44.21: expand ~ in pathnames
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 10 Nov 2010 17:49:30 +0000 (17:49 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 10 Nov 2010 17:49:30 +0000 (17:49 +0000)
commit9df2abae0a60d757448f06f0cc90213ec9fa775b
treef5400281508c6c82c0b03973a9f1c04aad67c923
parent110ebca58d7b7d64ce14b6ecd9885cf49ab4ba5d
1.0.44.21: expand ~ in pathnames

  ~/... => (:ABSOLUTE :HOME ...)

  ~user/... => (:ABSOLUTE (:HOME "user") ...)

  Translation back to NAMESTRING reinstates the tilde, so we retain
  read/write consistency.

  NATIVE-NAMESTRING is responsible for getting the actual full path
  to specified home directory.

  This late resolution is necessary to have (open "~/foo") and
  (open #p"~/foo") open the same file in compiled code -- regardless
  of who compiled the file.

  Tilde is treated specially only at the start of the first directory
  component: it doesn't need to be escaped anywhere else. After trying
  out the various options (escape everywhere, escape in directory
  components, escape at the start of directory components, escape at
  the start of all components) this seemed both least intrusive and
  least ambiguous when documented -- not to mention most backwards
  compatible.

  Currently escaping the tilde does not work on Windows, but this is due to
  current general inability to escape the first directory component on
  Windows, since \\ is used also as a directory separator for non-native
  pathnames as well. See lp#673625. Test-case added for this.

  (:HOME "user") also doesn't work on Windows, which is documented
  in the manual.
12 files changed:
doc/manual/pathnames.texinfo
package-data-list.lisp-expr
src/code/filesys.lisp
src/code/pathname.lisp
src/code/target-pathname.lisp
src/code/unix-pathname.lisp
src/code/unix.lisp
src/code/win32-pathname.lisp
src/code/win32.lisp
src/runtime/wrap.c
tests/pathnames.impure.lisp
version.lisp-expr