Lots of work
This commit is contained in:
		| @ -60,11 +60,17 @@ return file-systems that were mounted read-write." | ||||
| (defun device-id-for-path (path) | ||||
|   "Return the device id for the device on which PATH resides, or nil if it can't | ||||
| be determined." | ||||
|   #+sbcl (handler-case | ||||
|              (sb-posix:stat-dev (sb-posix:stat path)) | ||||
|            (sb-posix:syscall-error () | ||||
|              nil)) | ||||
|   #-(or sbcl) nil) | ||||
|   (handler-case | ||||
|       (osicat-posix:stat-dev (osicat-posix:stat path)) | ||||
|     (osicat-posix:posix-error () | ||||
|       nil))) | ||||
|  | ||||
| (declaim (ftype (function (string string) string) remove-suffix)) | ||||
| (defun remove-suffix (string suffix) | ||||
|   "Return STRING without SIFFIX." | ||||
|   (if (uiop:string-suffix-p string suffix) | ||||
|       (subseq string 0 (- (length string) (length suffix))) | ||||
|       string)) | ||||
|  | ||||
| (declaim (ftype (function ((or pathname string) &key (:ensure-directory t)) | ||||
|                           pathname) | ||||
| @ -85,8 +91,8 @@ be determined." | ||||
|   "Return the name of the last component of PATH, be it a file or directory." | ||||
|   (if (uiop:pathname-equal path "/") | ||||
|       "/" | ||||
|       (first (last (pathname-directory | ||||
|                     (ensure-nonwild-pathname path :ensure-directory t)))))) | ||||
|       (let ((unix-path (remove-suffix (uiop:unix-namestring path) "/"))) | ||||
|         (first (last (uiop:split-string unix-path :max 2 :separator '(#\/))))))) | ||||
|  | ||||
| (declaim (ftype (function ((or string pathname)) (or pathname null)) | ||||
|                 deepest-existing-path)) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user