24 lines
693 B
Common Lisp
24 lines
693 B
Common Lisp
;;;; clscopes/util
|
|
|
|
;;;; Common utilities for the scopes project.
|
|
|
|
(defpackage :scopes/util
|
|
(:use :common-lisp)
|
|
(:export #:relative-path #:runtime-path #:system-path))
|
|
|
|
(in-package :scopes/util)
|
|
|
|
(defun relative-path (name &rest dirs)
|
|
(let* ((parts (str:rsplit "." name :limit 2))
|
|
(n (pop parts))
|
|
(type (car parts)))
|
|
(when (string= n "")
|
|
(setf n name)
|
|
(setf type nil))
|
|
(make-pathname :name n :type type :directory (cons :relative dirs))))
|
|
|
|
(defun runtime-path (name &rest dirs)
|
|
(merge-pathnames (apply #'relative-path name dirs)))
|
|
|
|
(defun system-path (sys name &rest dirs)
|
|
(asdf:system-relative-pathname sys (apply #'relative-path name dirs)))
|