File tree 8 files changed +30
-11
lines changed
8 files changed +30
-11
lines changed Original file line number Diff line number Diff line change @@ -3887,6 +3887,7 @@ The preferred directory separator is \scheme{#\\} for Windows and
3887
3887
3888
3888
Combines \var{dir-path} and \var{path}, adding a directory separator
3889
3889
between them if needed.
3890
+ If \var{dir-path} is the empty string, \var{path} is returned.
3890
3891
3891
3892
%----------------------------------------------------------------------------
3892
3893
\entryheader
Original file line number Diff line number Diff line change 3332
3332
(error? (path-last ' a/ b/ c))
3333
3333
(error? (path- root ' a/b/c))
3334
3334
(error? (path-extension ' a/ b/ c))
3335
+ (error? (path- build ' a ' b))
3335
3336
3336
3337
(eq? (path- absolute? " " ) #f )
3337
3338
(eq? (path- absolute? " a" ) #f )
3409
3410
(equal? (path- extension " c:.." ) " " )
3410
3411
(equal? (path- extension " c:" ) " " )
3411
3412
3413
+ (equal? (path- build " " " b.ss" ) " b.ss" )
3414
+ (if (windows? )
3415
+ (equal? (path- build " ." " b.ss" ) " .\\ b.ss" )
3416
+ (equal? (path- build " ." " b.ss" ) " ./b.ss" ))
3417
+ (if (windows? )
3418
+ (equal? (path- build " .\\ " " b.ss" ) " .\\ b.ss" )
3419
+ (equal? (path- build " ./" " b.ss" ) " ./b.ss" ))
3420
+ (if (windows? )
3421
+ (equal? (path- build " foo" " b.ss" ) " foo\\ b.ss" )
3422
+ (equal? (path- build " foo" " b.ss" ) " foo/b.ss" ))
3423
+ (if (windows? )
3424
+ (equal? (path- build " quux\\ " " b.ss" ) " quux\\ b.ss" )
3425
+ (equal? (path- build " quux/" " b.ss" ) " quux/b.ss" ))
3426
+
3412
3427
; if this test fails, search for the asterisks in the printed table
3413
3428
(let ([okay? #t ])
3414
3429
(define print- table
Original file line number Diff line number Diff line change @@ -7257,6 +7257,7 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
7257
7257
6.mo:Expected error in mat pathprocs: "path-last: a/b/c is not a string".
7258
7258
6.mo:Expected error in mat pathprocs: "path-root: a/b/c is not a string".
7259
7259
6.mo:Expected error in mat pathprocs: "path-extension: a/b/c is not a string".
7260
+ 6.mo:Expected error in mat pathprocs: "path-build: a is not a string".
7260
7261
6.mo:Expected error in mat process: "write-char: not permitted on closed port sanitized-port".
7261
7262
6.mo:Expected error in mat process: "write-char: not permitted on closed port sanitized-port".
7262
7263
6.mo:Expected error in mat process: "flush-output-port: not permitted on closed port sanitized-port".
Original file line number Diff line number Diff line change 544
544
(lambda (dir fn )
545
545
(unless (string? dir) ($oops who " ~s is not a string" dir))
546
546
(unless (string? fn) ($oops who " ~s is not a string" fn))
547
- (format
548
- ( if (directory-separator?
549
- (string-ref dir
550
- (fx- ( string-length dir) 1 )))
551
- " ~a~a "
552
- (string-append " ~a " (string (directory-separator)) " ~a " ))
553
- dir fn )))
547
+ (cond
548
+ [( string=? dir " " ) fn]
549
+ [(directory-separator?
550
+ ( string-ref dir
551
+ (fx- (string-length dir) 1 )))
552
+ (string-append dir fn)]
553
+ [ else (string-append dir (string (directory-separator)) fn)] )))
554
554
)
555
555
)
Original file line number Diff line number Diff line change 112
112
(if (null? ls)
113
113
($oops whoarg " file ~s not found in source directories" fn)
114
114
(let ([path (let ([dir (car ls)])
115
- (if (or ( string=? dir " " ) ( string=? dir " . " ) )
115
+ (if (string=? dir " . " )
116
116
fn
117
117
(path-build dir fn)))])
118
118
(if (guard (c [#t #f ]) (close-input-port (open-input-file path)) #t )
Original file line number Diff line number Diff line change 1731
1731
(and (not (null? dir*))
1732
1732
(or (source-port
1733
1733
(let ([dir (car dir*)])
1734
- (if (or ( string=? dir " " ) ( string=? dir " . " ) )
1734
+ (if (string=? dir " . " )
1735
1735
name
1736
1736
(path-build dir name))))
1737
1737
(search name (cdr dir*)))))
Original file line number Diff line number Diff line change 145
145
[else
146
146
(define path-build
147
147
(lambda (a b )
148
- (let ([sep (if (eqv? (string-ref a (sub1 (string-length a))) #\/ ) " " " /" )])
148
+ (let ([sep (if (or (string=? a " " )
149
+ (eqv? (string-ref a (sub1 (string-length a)))) #\/ )
150
+ " " " /" )])
149
151
(string-append a sep b))))])
150
152
151
153
(let ([machine.def (path-build xc-dir " machine.def" )])
Original file line number Diff line number Diff line change 4787
4787
e1 e2 ...)]))
4788
4788
(define make-path
4789
4789
(lambda (dir rpath ext )
4790
- (if (or ( string=? dir " " ) ( string=? dir " . " ) )
4790
+ (if (string=? dir " . " )
4791
4791
(format " ~a~a" rpath ext)
4792
4792
(path-build dir (format " ~a~a" rpath ext)))))
4793
4793
(let ([rpath (fold-left (lambda (dir elem ) (path-build dir (symbol->string elem))) (symbol->string (car path)) (cdr path))])
You can’t perform that action at this time.
0 commit comments