--- a/HierarchicalURI.st Thu Jul 10 14:07:39 2003 +0200
+++ b/HierarchicalURI.st Thu Jul 10 16:33:01 2003 +0200
@@ -271,7 +271,7 @@
|i i1 separator|
(aString startsWith:'//') ifTrue:[
- i := aString indexOfAny:'/?#' startingAt:3.
+ i := aString indexOfAny:'~/?#' startingAt:3.
i == 0 ifTrue:[
authority := aString copyFrom:3.
^ self.
@@ -279,7 +279,7 @@
separator := aString at:i.
authority := aString copyFrom:3 to:i-1.
].
- isAbsolute := true.
+ (isAbsolute := (aString at:i) == $/).
] ifFalse:[
(isAbsolute := aString startsWith:$/) ifTrue:[
i := 1.
@@ -288,6 +288,15 @@
]
].
+ isAbsolute ifFalse:[
+ i ~~ 0 ifTrue:[
+ (aString at:i) == $~ ifTrue:[
+ pathSegments add:'~'.
+ i := i + 1
+ ].
+ ].
+ ].
+
[
i1 := aString indexOfAny:'/?#' startingAt:i+1.
i1 == 0 ifTrue:[ |path|
@@ -303,6 +312,16 @@
] ifFalse:[
separator := aString at:i1.
pathSegments add:(aString copyFrom:i+1 to:i1-1).
+ isAbsolute ifTrue:[
+ pathSegments size == 1 ifTrue:[
+ pathSegments first = '~' ifTrue:[
+ isAbsolute := false
+ ].
+ ].
+ ].
+ (pathSegments size == 1 and:[pathSegments first = '~']) ifTrue:[
+
+ ].
i := i1.
].
] doWhile:[separator == $/].
@@ -323,6 +342,9 @@
].
"
+ self new fromString:'//exept~/tmp'
+ self new fromString:'~/tmp'
+ self new fromString:'/~/tmp'
self new fromString:'//authority/path1/path2/'
self new fromString:'//authority/path1/path2?query'
self new fromString:'//authority/path1/path2?query#fragment'
@@ -444,5 +466,5 @@
!HierarchicalURI class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/HierarchicalURI.st,v 1.3 2003-07-09 12:51:46 tm Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/HierarchicalURI.st,v 1.4 2003-07-10 14:33:01 tm Exp $'
! !