Documentation
Converts QUERY-PATH to a file on the local filesystem assuming
the application is mapped to URL-BASE and lives in DIRECTORY.
In other words: if query-path is "<URL-BASE><SOMETHING>"
returns: "<DIRECTORY><SOMETHING>" (assuming said file
exists), otherwise returns NIL.
Source
(defun map-query-path-to-file (query-path url-base directory)
"Converts QUERY-PATH to a file on the local filesystem assuming
the application is mapped to URL-BASE and lives in DIRECTORY.
In other words: if query-path is \"<URL-BASE><SOMETHING>\"
returns: \"<DIRECTORY><SOMETHING>\" (assuming said file
exists), otherwise returns NIL."
;; NB: We really could (and should) cache this function on
;; QUERY-PATH, but we need to figure out how to wipe the cache when
;; an application's url-prefix changes. considering how rarely that
;; happens it's sucks that we lose the spped increase this could
;; bring...
(multiple-value-bind (starts-with <something>)
(starts-with query-path url-base :return-suffix t)
(if starts-with
(let ((pathname (merge-pathnames <something> directory)))
(if (probe-file pathname)
pathname
nil))
nil)))Source Context