Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

common lisp - get path to file

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.

like image 1000
Lucas Wickström Avatar asked Dec 07 '11 02:12

Lucas Wickström


1 Answers

This ought to be a comment but I'm going to give some code examples that might help the original poster along.

First of all, you need to be a little more clear about what you want to do. What is the problem you're trying to solve?

Secondly, here are a couple of examples which could be useful:

  • *default-pathname-defaults* usually set to the directory the CL image was started up in:

    * *default-pathname-defaults*
    #P"/Users/aerique/"
    
  • merge-pathnames allows you to construct new pathnames:

    * (merge-pathnames "lib/misc" *default-pathname-defaults*)
    #P"/Users/aerique/lib/misc"
    * (merge-pathnames "lib/misc/" *default-pathname-defaults*)
    #P"/Users/aerique/lib/misc/"
    
  • asdf:system-source-directory returns the path to a system loaded with ASDF:

    * (asdf:system-source-directory :linedit)  
    #P"/Users/aerique/quicklisp/dists/quicklisp/software/linedit-20111203-git/"
    

Also see the linked ASDF manual for more useful file and system functions.

like image 113
aerique Avatar answered Oct 15 '22 19:10

aerique