1
0
Fork 0

- added function 'fs:path-referencing-dir-p'.

This commit is contained in:
cage 2022-01-23 13:06:24 +01:00
parent 1d2d528d95
commit 1cf9be1863
5 changed files with 8 additions and 3 deletions

View File

@ -32,7 +32,8 @@
(in-package :modules) (in-package :modules)
(defparameter *expand-abbrev-rewriting-rules* '(("^!g" "gemini://")) (defparameter *expand-abbrev-rewriting-rules* '(("^!g" "gemini://")
("^!n" "np://"))
"Before displaying messages that module will rewrites the first "Before displaying messages that module will rewrites the first
element of each item (a regular expression) of this list with the second element of each item (a regular expression) of this list with the second

View File

@ -23,7 +23,7 @@
(not dirp)) (not dirp))
(list :path path :dirp dirp :markedp nil)) (list :path path :dirp dirp :markedp nil))
(dirp (dirp
(if (scan "/$" path) (if (fs:path-referencing-dir-p path)
(list :path path :dirp t :markedp nil) (list :path path :dirp t :markedp nil)
(list :path (strcat path "/") :dirp t :markedp nil))))) (list :path (strcat path "/") :dirp t :markedp nil)))))

View File

@ -152,6 +152,9 @@
(defun loopback-reference-dir-p (path) (defun loopback-reference-dir-p (path)
(string= (path-last-element path) ".")) (string= (path-last-element path) "."))
(defun path-referencing-dir-p (path)
(cl-ppcre:scan "/$" path))
(defun collect-files/dirs (root) (defun collect-files/dirs (root)
(let ((all-files '()) (let ((all-files '())
(all-dirs '())) (all-dirs '()))

View File

@ -85,7 +85,7 @@
(assert path) (assert path)
(with-cloned-root-fid (*stream* root-fid) (with-cloned-root-fid (*stream* root-fid)
(if dirp (if dirp
(9p:create-path *stream* root-fid (if (cl-ppcre:scan "/$" path) (9p:create-path *stream* root-fid (if (fs:path-referencing-dir-p path)
path path
(text-utils:strcat path "/"))) (text-utils:strcat path "/")))
(9p:create-path *stream* root-fid path)))))) (9p:create-path *stream* root-fid path))))))

View File

@ -289,6 +289,7 @@
:collect-children :collect-children
:backreference-dir-p :backreference-dir-p
:loopback-reference-dir-p :loopback-reference-dir-p
:path-referencing-dir-p
:collect-files/dirs :collect-files/dirs
:prepend-pwd :prepend-pwd
:search-matching-file :search-matching-file