Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Last active November 22, 2016 12:39
Show Gist options
  • Save zhouqiang-cl/b8c1cb2b14ff608a875ba0c8664559b3 to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/b8c1cb2b14ff608a875ba0c8664559b3 to your computer and use it in GitHub Desktop.
common lisp 路径 PATHNAME
语法
merge-pathnames pathname &optional default-pathname default-version
make-pathname &key host device directory name type version defaults case
pathname-directory pathname &key case => directory
参数和值
pathname --- 路径名
default-pathname --- 默认的pathname, 是 *default-pathname-defaults* 的值(这个值一般是运行路径)
default-version --- pathname 的 version, 默认是 :newest
pathname-directory --- 获取 pathname 的目录路径
描述
merge-pathnames 这个函数根据现有的pathname的传入的 pathname 生成新的pathname
make-pathname 生成一个 pathname
code
* *default-pathname-defaults*
#P"/Users/zhouqiang/workspace/"
* (merge-pathnames "a")
#P"/Users/zhouqiang/workspace/a"
* (merge-pathnames "/Users/zh/wo")
#P"/Users/zh/wo"
* (make-pathname :directory "/x"
:name "y"
:type "z")
#P"//x/y.z"
* (pathname-directory "/a/b/c")
(:ABSOLUTE "a" "b")
* (pathname-directory "a/b/c")
(:RELATIVE "a" "b")
TODO
merge-pathname 的结果有点诡异, 需要详细理解一下
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment