common lisp - get path to file

后端 未结 5 2345
南旧
南旧 2021-02-19 19:49

In Common Lisp, is there a way to get the path to a compiled file (something like current-directory)?

The file is not inside the current-directory folder.

5条回答
  •  盖世英雄少女心
    2021-02-19 20:05

    If you want get the pathname whitout use ASDF function, but you need also attend the users that use ASDF, you can use like this:

    (defmacro project-pathname ()
      (let ((path (or *compile-file-pathname* *load-truename*)))
        `(progn ,path)))
    

    It's necessary because the ASDF stores in one "/home/you/.../.cache/..." directory, and you need capture the pathname in compilation time with one macro.

提交回复
热议问题