--- a/FileURI.st Thu Jul 10 14:07:39 2003 +0200
+++ b/FileURI.st Thu Jul 10 16:33:01 2003 +0200
@@ -131,7 +131,7 @@
|attributes fn files list dirPath|
- fn := self asFilename.
+ fn := self path asFilename.
files := OrderedCollection new.
list := OrderedCollection new.
attributes := self class attributes.
@@ -235,7 +235,7 @@
|stream fileName|
- fileName := self asFilename.
+ fileName := self path asFilename.
[
Stream streamErrorSignal handle:[:ex|
doCreate ifFalse:[
@@ -263,5 +263,5 @@
!FileURI class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/FileURI.st,v 1.5 2003-07-10 12:07:29 tm Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/FileURI.st,v 1.6 2003-07-10 14:32:51 tm Exp $'
! !
--- a/FtpURI.st Thu Jul 10 14:07:39 2003 +0200
+++ b/FtpURI.st Thu Jul 10 16:33:01 2003 +0200
@@ -208,6 +208,7 @@
[ aBlock value:stream value:attributes ]
ensure:[ stream close ].
doRemoveSource == true ifTrue:[
+ (srcPath startsWith:'/') ifFalse:[ srcPath := '/', srcPath ].
ftp delete:srcPath.
].
].
@@ -269,9 +270,13 @@
writeStreamDo:aBlock create:doCreate
"use FTPClient for now"
- |path|
+ |path absDir absPath|
path := self path.
+ (path startsWith:'/')
+ ifTrue:[ absPath := path]
+ ifFalse:[ absPath := '/', path ].
+ absDir := absPath asFilename directory.
self connectThenDo:[:ftp| |stream|
[
ftp connectTo:self host
@@ -279,14 +284,17 @@
user:(self user ? self defaultUser)
password:(self password ? self defaultPassword).
- Stream streamErrorSignal handle:[:ex|
+ FTPClient filePutErrorSignal handle:[:ex| |str|
doCreate ifFalse:[
ex reject
].
- ftp mkdir:path asFilename directory pathName.
- stream := ftp putStreamFor:path.
+ FTPClient fileNotFoundErrorSignal handle:[:ex| ] do:[
+ ftp mkdir:absDir.
+ ].
+ ftp cd:absDir.
+ stream := ftp putStreamFor:absPath.
] do:[
- stream := ftp putStreamFor:path.
+ stream := ftp putStreamFor:absPath.
].
aBlock value:stream value:self class attributes.
@@ -307,5 +315,5 @@
!FtpURI class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/FtpURI.st,v 1.6 2003-07-10 12:07:39 tm Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/FtpURI.st,v 1.7 2003-07-10 14:32:44 tm Exp $'
! !
--- 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 $'
! !