Skip to content

Commit a03c1f8

Browse files
committed
Add LIST-LOCAL-PROJECTS.
1 parent b087d71 commit a03c1f8

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

local-projects.lisp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@ to use the local project directory and cache to find systems."
9393
(when system
9494
(return system))))))))
9595

96+
(defun list-local-projects ()
97+
"Return a list of pathnames to local project system files."
98+
(let ((result (make-array 16 :fill-pointer 0 :adjustable t))
99+
(seen (make-hash-table :test 'equal)))
100+
(dolist (directory *local-project-directories*
101+
(coerce result 'list))
102+
(let ((index (ensure-system-index directory)))
103+
(when index
104+
(with-open-file (stream index)
105+
(loop for line = (read-line stream nil)
106+
while line do
107+
(let ((pathname (merge-pathnames line index)))
108+
(unless (gethash (pathname-name pathname) seen)
109+
(setf (gethash (pathname-name pathname) seen) t)
110+
(vector-push-extend (merge-pathnames line index)
111+
result))))))))))
112+
96113
(defun register-local-projects ()
97114
"Force a scan of the local projects directory to create the system
98115
file index."

package.lisp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@
275275
#:help
276276
#:register-local-projects
277277
#:local-projects-searcher
278-
#:*local-project-directories*))
278+
#:*local-project-directories*
279+
#:list-local-projects))
279280

280281
(in-package #:quicklisp-client)
281282

0 commit comments

Comments
 (0)