path-replace-suffix: raise exception when result should be an empty path
This commit is contained in:
parent
afcecc73f1
commit
d23d2f8c5b
|
@ -28,6 +28,8 @@
|
|||
path-add-suffix (string->some-system-path "p/x" 'unix) ".zo")
|
||||
(test (string->some-system-path "p/x.zo" 'windows)
|
||||
path-add-suffix (string->some-system-path "p/x" 'windows) ".zo")
|
||||
(err/rt-test (path-replace-suffix ".zo" ""))
|
||||
(err/rt-test (path-replace-suffix ".zo" #""))
|
||||
|
||||
(define (make-/tf p exn?)
|
||||
(lambda args
|
||||
|
|
|
@ -2,6 +2,8 @@ Version 5.90.0.10
|
|||
Added chaperone-channel and impersonate-channel
|
||||
Change string->path-element and bytes->path-element to raise an
|
||||
exception for an empty [byte-]string argument
|
||||
Change path-replace-suffix to raise an excpetion when a path element
|
||||
would be made empty
|
||||
|
||||
Version 5.90.0.9
|
||||
Allow hash table chaperones and impersonators to support efficient
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -880,13 +880,18 @@
|
|||
(define finish
|
||||
(lambda (i sep i2)
|
||||
(bytes->path-element
|
||||
(bytes-append
|
||||
(subbytes bs 0 i)
|
||||
sep
|
||||
(rest-bytes bs i2)
|
||||
(if (string? sfx)
|
||||
(string->bytes/locale sfx (char->integer #\?))
|
||||
sfx))
|
||||
(let ([res (bytes-append
|
||||
(subbytes bs 0 i)
|
||||
sep
|
||||
(rest-bytes bs i2)
|
||||
(if (string? sfx)
|
||||
(string->bytes/locale sfx (char->integer #\?))
|
||||
sfx))])
|
||||
(if (zero? (bytes-length res))
|
||||
(raise-arguments-error 'path-replace-suffix
|
||||
"removing suffix makes path element empty"
|
||||
"given path" s)
|
||||
res))
|
||||
(if (path-for-some-system? s)
|
||||
(path-convention-type s)
|
||||
(system-path-convention-type)))))
|
||||
|
|
Loading…
Reference in New Issue
Block a user