File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -979,13 +979,19 @@ nil."
979979
980980
981981
982- (defun clojure-project-dir ()
983- " Return the absolute path to the project's root directory."
984- (file-truename
985- (or (locate-dominating-file default-directory
986- " project.clj" )
987- (locate-dominating-file default-directory
988- " build.boot" ))))
982+ (defun clojure-project-dir (&optional dir-name )
983+ " Return the absolute path to the project's root directory.
984+
985+ Use `default-directory' if DIR-NAME is nil."
986+ (let ((dir-name (or dir-name default-directory)))
987+ (let ((lein-project-dir (locate-dominating-file dir-name " project.clj" ))
988+ (boot-project-dir (locate-dominating-file dir-name " build.boot" )))
989+ (file-truename
990+ (cond ((not lein-project-dir) boot-project-dir)
991+ ((not boot-project-dir) lein-project-dir)
992+ (t (if (file-in-directory-p lein-project-dir boot-project-dir)
993+ lein-project-dir
994+ boot-project-dir)))))))
989995
990996(defun clojure-project-relative-path (path )
991997 " Denormalize PATH by making it relative to the project root."
You can’t perform that action at this time.
0 commit comments