Skip to content

Commit

Permalink
(cabbage-project-expand-path) builds relative project paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
senny committed Mar 21, 2013
1 parent 56cc1ed commit a78d647
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/bundles/framework.el
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
((> (length (intersection present-files cabbage-project-root-indicators :test 'string=)) 0) directory)
(t (cabbage-project-root (file-name-directory (directory-file-name directory)))))))

(defun cabbage-project-expand-path (&rest segments)
"Construct a path relative to the cabbage-project-root"
(let ((project-root (cabbage-project-root)))
(when (not project-root) (error "Could not detect project root"))
(let ((path (mapconcat 'identity segments "/"))
(installation-dir (replace-regexp-in-string "/$" "" project-root)))
(expand-file-name (concat installation-dir "/" path)))))

;; API: integrated testing
(defvar cabbage-testing--last-project-root nil
"cache for the project-root of the last executed spec-file")
Expand Down

0 comments on commit a78d647

Please sign in to comment.