路径名包含了六个部分:host(主机)、device(设备)、directory(目录)、name(名称)、type(类型) 及 version(版本)
default-pathname-defaults 决定了生成路径的根路径
(defparameter *path* (make-pathname
               :directory '(:relative "a" "b")
               :name "main"
               :type "lisp"))
(print *path*) ; #P"a\\b\\main.lisp"
;; 带盘符
(defparameter *path* (make-pathname
               :device "F"
               :directory '(:absolute "a" "b")
               :name "main"
               :type "lisp"))
(print *path*) ; #P"F:\\a\\b\\main.lisp"
(defparameter *path* (make-pathname
               :directory '(:absolute "a" "b")
               :defaults "main.ts"))
(print *path*) ; #P"\\a\\b\\main.ts"更具本地文件名语法解析
(pathname "./a/b/main.txt") ; #P"a\\b\\main.txt"   路径名叙述符
(namestring  #P"a\\b\\main.txt") ; "a\\b\\main.txt" 返回字符传
(directory-namestring  #P"a\\b\\main.txt") ; "a\\b\\"  返回路径的字符串
(file-namestring  #P"a\\b\\main.txt") ; "main.txt"  返回name+type
(pathname-name (pathname "./a/b/main.lisp")) ; main
(pathname-type (pathname "./a/b/main.lisp")) ; lisp
(pathname-directory (pathname "./a/b/main.lisp")) ; (:RELATIVE "a" "b") 相对路径
pathname-host, pathname-device,  返回驱动器字符
pathname-version(merge-pathnames #p"dist/index.html" #p"dist/index.html" #p"/www/html/") ; #P"\\www\\html\\dist\\index.html"
(enough-namestring #p"dist/index.html" #p"dist/") ; "index.html"不存在返回nil,存在则返回完整的路径
(print (probe-file #p"./as"))他并不是 __dirname,执行程序所在的文件位置
(directory "./")原文:https://www.cnblogs.com/ajanuw/p/9052763.html