【发布时间】:2014-04-15 14:09:57
【问题描述】:
这个问题是How does one pre-load a clojure file in the leiningen repl? 的后续问题。
我的~/.lein/profiles.clj 如下所示:
{
:user {:source-paths ["C:/Users/username/.lein/src"] }
}
我的~/.lein/src/user.clj 可能如下所示:
(ns user)
(println "user file loaded")
当我在包含project.clj 的文件夹中运行lein repl 时,会执行user.clj 文件,但是当我从另一个文件夹运行lein repl 时,它不会加载我的用户配置文件。是否有解决方法或者这种行为是设计使然?事实上,我知道 Leinigen 确实在加载我的 profile.clj(即使没有 project.clj),因为里面还有其他东西(摘自优秀的 pimp my repl 文章)。 Leinigen 只是对我的附加源路径设置有问题。
与此相关的另一个问题是我需要为我的user.clj 文件指定文件夹的完整路径:"C:/Users/username/.lein/src"。当我将其更改为 "~/.lein/src" 时,leiningen 无法加载我的文件。
【问题讨论】:
-
您是否在文档中看到任何建议源路径中的
~应该有效?一般来说,波浪号扩展只适用于 Linux shell - 我不希望它在 Java 或 Windows 平台上工作。 -
很好:将其替换为 {:source-paths [~(str (System/getProperty "user.home") "/.lein/src")]} 并且有效。但是我仍然无法从其中没有 project.clj 的文件夹中使用它。