-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpath.lisp
51 lines (40 loc) · 1.68 KB
/
path.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(in-package :shipshape)
;; before shipped path is local to system
;; after shipped (and if has manifest) is local to media/system-name/
(defun local-path (path system)
;; local-media-path is inlined as then the compiler will optimize away
;; the redudent conditionals
(let ((manifest (when *shipped* (find-manifest system))))
(if manifest
(progn
(format t "~%shipped ~a, manifest ~a" *shipped* manifest)
(local-media-path manifest path))
(asdf:system-relative-pathname system path))))
(defun local-media-path (manifest &optional (path ""))
(with-slots (system system-media-path) manifest
(reduce #'(lambda (x y) (merge-pathnames y x))
(list system-media-path
(format nil "~a/" system)
path)
:initial-value
(if *shipped*
(directory-namestring (first sb-ext:*posix-argv*))
(asdf:system-relative-pathname system (build-path manifest))))))
(defun local-c-library-path (manifest &optional (path ""))
(with-slots (system c-library-path) manifest
(reduce #'(lambda (x y) (merge-pathnames y x))
(list c-library-path
path)
:initial-value
(if *shipped*
(directory-namestring (first sb-ext:*posix-argv*))
(asdf:system-relative-pathname system (build-path manifest))))))
(defun ensure-no-directory (pathname)
(when (cl-fad:directory-exists-p pathname)
(cl-fad:delete-directory-and-files pathname)))
;; local-path
;; - relative to system
;; - relative to system media path
;; local-media-path
;; - in build-folder/system-media-path
;; - in exe-path/system-media-path