From 5d90d65ab960c11dda06f90354b263cad3415c44 Mon Sep 17 00:00:00 2001 From: cxxxr Date: Sun, 23 Jul 2023 20:12:12 +0900 Subject: [PATCH] fix for .steampath --- src/ext/directory-mode.lisp | 70 +++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/src/ext/directory-mode.lisp b/src/ext/directory-mode.lisp index 04f0e35dc..166e79276 100644 --- a/src/ext/directory-mode.lisp +++ b/src/ext/directory-mode.lisp @@ -184,41 +184,43 @@ t))))) (defun insert-pathname (point pathname directory &optional content) - (with-point ((start point)) - (let ((name (or content (namestring (enough-namestring pathname directory))))) - (insert-string point " " 'pathname pathname 'name name) - (insert-string point - (format nil " ~5@A " - (let ((size (file-size pathname))) - (if size (human-readable-file-size size) ""))) - :attribute 'file-size-attribute) - (multiple-value-bind (second minute hour day month year week) - (let ((date (file-write-date pathname))) - (if date - (decode-universal-time date) - (values 0 0 0 0 0 0 nil))) + (let ((file-size (handler-case (file-size pathname) + (error () + (return-from insert-pathname))))) + (with-point ((start point)) + (let ((name (or content (namestring (enough-namestring pathname directory))))) + (insert-string point " " 'pathname pathname 'name name) (insert-string point - (format nil "~4,'0D/~2,'0D/~2,'0D ~2,'0D:~2,'0D:~2,'0D ~A " - year month day hour minute second - (if week (aref #("Mon" "Tue" "Wed" "Thr" "Fri" "Sat" "Sun") week) - " ")) - :attribute 'file-date-attribute)) - (unless (string= name "..") - (insert-icon point name)) - (insert-string point - name - :attribute (get-file-attribute pathname) - :file pathname) - (when (symbolic-link-p pathname) - (insert-string point (format nil " -> ~A" (probe-file pathname)))) - (back-to-indentation start) - (lem/button:apply-button-between-points - start point - (lambda () - (lem/button:with-context () - (directory-mode-find-file)))) - (insert-character point #\newline) - (put-text-property start point :read-only t)))) + (format nil " ~5@A " + (if file-size (human-readable-file-size file-size) "")) + :attribute 'file-size-attribute) + (multiple-value-bind (second minute hour day month year week) + (let ((date (file-write-date pathname))) + (if date + (decode-universal-time date) + (values 0 0 0 0 0 0 nil))) + (insert-string point + (format nil "~4,'0D/~2,'0D/~2,'0D ~2,'0D:~2,'0D:~2,'0D ~A " + year month day hour minute second + (if week (aref #("Mon" "Tue" "Wed" "Thr" "Fri" "Sat" "Sun") week) + " ")) + :attribute 'file-date-attribute)) + (unless (string= name "..") + (insert-icon point name)) + (insert-string point + name + :attribute (get-file-attribute pathname) + :file pathname) + (when (symbolic-link-p pathname) + (insert-string point (format nil " -> ~A" (probe-file pathname)))) + (back-to-indentation start) + (lem/button:apply-button-between-points + start point + (lambda () + (lem/button:with-context () + (directory-mode-find-file)))) + (insert-character point #\newline) + (put-text-property start point :read-only t))))) (defun insert-directories-and-files (point directory