Changeset 7900 in project


Ignore:
Timestamp:
01/23/08 23:43:43 (12 years ago)
Author:
Kon Lovett
Message:

Fixed use of boolean valued 'pds' in 'make-absolute-pathname' - '##sys#string-append' wants only strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/utils.scm

    r7181 r7900  
    231231(define make-pathname)
    232232(define make-absolute-pathname)
    233 
    234233(let ([string-append string-append]
    235       [absolute-pathname? absolute-pathname?])
     234      [absolute-pathname? absolute-pathname?]
     235      [def-pds "/"] )
    236236
    237237  (define (conc-dirs dirs pds)
     
    245245                (string-append
    246246                 (chop-pds (car strs) pds)
    247                  (or pds "/")
     247                 (or pds def-pds)
    248248                 (loop (cdr strs))) ) ) ) ) )
    249249
    250   (define (canonicalize dir pds)
     250  (define (canonicalize-dirs dir pds)
    251251    (cond [(or (not dir) (null? dir)) ""]
    252252          [(string? dir) (conc-dirs (list dir) pds)]
     
    254254
    255255  (define (_make-pathname loc dir file ext pds)
    256     (let ([dirs (canonicalize dir pds)]
    257           [pdslen (if pds (##sys#size pds) 1)]
    258           [ext (or ext "")]
    259           [file (or file "")] )
     256    (let ([ext (or ext "")]
     257          [file (or file "")]
     258          [pdslen (if pds (##sys#size pds) 1)] )
     259      (##sys#check-string dir loc)
    260260      (##sys#check-string file loc)
    261261      (##sys#check-string ext loc)
    262262      (when pds (##sys#check-string pds loc))
    263263      (string-append
    264        dirs
     264       dir
    265265       (if (and dir
    266266                (and (fx>= (##sys#size file) pdslen)
     
    277277
    278278  (set! make-pathname
    279     (lambda (dir file #!optional ext pds)
    280       (_make-pathname 'make-pathname dir file ext pds)))
     279    (lambda (dirs file #!optional ext pds)
     280      (_make-pathname 'make-pathname (canonicalize-dirs dirs pds) file ext pds)))
    281281
    282282  (set! make-absolute-pathname
    283     (lambda (dir file #!optional ext pds)
     283    (lambda (dirs file #!optional ext pds)
    284284      (_make-pathname
    285285       'make-absolute-pathname
    286        (let* ([dirs (canonicalize dir pds)]
    287               [dlen (##sys#size dirs)] )
    288          (if (not (absolute-pathname? dirs))
    289              (##sys#string-append pds dirs)
    290              dirs) )
     286       (let ([dir (canonicalize-dirs dirs pds)])
     287         (if (absolute-pathname? dir)
     288             dir
     289             (##sys#string-append (or pds def-pds) dir)) )
    291290       file ext pds) ) ) )
    292291
Note: See TracChangeset for help on using the changeset viewer.