chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] calling pathname-directory with trailing slash


From: felix winkelmann
Subject: Re: [Chicken-users] calling pathname-directory with trailing slash
Date: Sat, 14 Apr 2007 22:01:34 +0200

On 4/13/07, Andre Kuehne <address@hidden> wrote:
Hi

#1> (pathname-directory "a/b")
"a"
#2> (pathname-directory "a/b/")
"a/b/"

If you start with a path which has no trailing slash, you can pass the result 
of calling
pathname-directory repeatedly to the function to get one directory level up at 
a time.

But if you start with a trailing slash, you are stuck.

Wouldn't returning "a/b"in #2 be more consistent?

Quite right - here a patch:

--- old-chicken/utils.scm       2007-04-14 21:55:39.000000000 +0200
+++ new-chicken/utils.scm       2007-04-14 21:55:39.000000000 +0200
@@ -206,7 +206,7 @@
         [set (##sys#string-append "\\/\\" pds)]
         [rx1 (string-append "^(.*[" set "])?([^" set "]+)(\\.([^" set 
".]+))$")]
         [rx2 (string-append "^(.*[" set "])?((\\.)?[^" set "]+)$")]
-        [string-match string-match]
+        [string-search string-search]
         [strip-pds
           (lambda (dir)
              (and dir
@@ -223,7 +223,7 @@
                (let ([m (string-search rx2 pn)])
                  (if m
                      (values (strip-pds (cadr m)) (caddr m) #f)
-                     (values pn #f #f) ) ) ) ) ) ) ) )
+                     (values (strip-pds pn) #f #f) ) ) ) ) ) ) ) )

(let ([decompose-pathname decompose-pathname])
  (set! pathname-directory


(or fetch the newest darcs version)


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]