Permalink
Browse files

Replace cl-fad by UIOP.

  • Loading branch information...
1 parent d73474b commit 6fba1ee547058c6c6845a02ecdefacfd50eaf6b2 @fukamachi committed Aug 26, 2015
Showing with 18 additions and 10 deletions.
  1. +1 −1 clack-v1-compat.asd
  2. +14 −6 v1-compat/src/core/app/directory.lisp
  3. +3 −3 v1-compat/src/core/app/file.lisp
View
@@ -15,7 +15,7 @@
:marshal
:cl-base64
:cl-ppcre
- :cl-fad
+ :uiop
:quri
:trivial-mimes
:trivial-types
@@ -6,11 +6,11 @@
:<clack-app-file>
:should-handle
:serve-path)
- (:import-from :cl-fad
+ (:import-from :uiop
:file-exists-p
- :directory-exists-p
:directory-pathname-p
- :list-directory)
+ :subdirectories
+ :directory-files)
(:import-from :local-time
:format-rfc1123-timestring
:universal-to-timestamp)
@@ -33,11 +33,19 @@
:port port))
(defmethod should-handle ((this <clack-app-directory>) file)
- (file-exists-p file))
+ (uiop:file-exists-p file))
+
+(defun list-directory (dir)
+ (sort (nconc (uiop:subdirectories dir) (uiop:directory-files dir))
+ #'string<
+ :key (lambda (path)
+ (if (uiop:directory-pathname-p path)
+ (car (last (pathname-directory path)))
+ (file-namestring path)))))
(defmethod serve-path ((this <clack-app-directory>) env file encoding)
(declare (ignore encoding))
- (if (directory-pathname-p file)
+ (if (uiop:directory-pathname-p file)
`(200 nil (,(dir-page
(getf env :path-info)
(format nil "~A~{~A~}"
@@ -63,7 +71,7 @@
(defun dir-file (file &key uri name)
"Stolen from rack/directory.rb."
- (let* ((dir-p (directory-pathname-p file))
+ (let* ((dir-p (uiop:directory-pathname-p file))
(uri (or uri
(if dir-p
(car (last (pathname-directory file)))
@@ -9,7 +9,7 @@
(:import-from :local-time
:format-rfc1123-timestring
:universal-to-timestamp)
- (:import-from :cl-fad
+ (:import-from :uiop
:file-exists-p
:directory-exists-p)
(:import-from :alexandria
@@ -66,8 +66,8 @@
;; Ignore simple-file-error in a case that
;; the file path contains some special characters like "?".
;; See https://github.com/fukamachi/clack/issues/111
- (file-exists-p file))
- (not (directory-exists-p file)))))
+ (uiop:file-exists-p file))
+ (not (uiop:directory-exists-p file)))))
@export
(defgeneric locate-file (app path root)

0 comments on commit 6fba1ee

Please sign in to comment.