FileURI.st
changeset 1266 4522fd38deef
parent 1264 650132956801
child 1267 5e7f102e094d
--- a/FileURI.st	Thu Jul 10 12:24:21 2003 +0200
+++ b/FileURI.st	Thu Jul 10 14:07:39 2003 +0200
@@ -129,7 +129,7 @@
      - a collection with a stream on a single file,
      - or a collection with streams on a directorie's files, but not recursive"
 
-    |attributes fn files list|
+    |attributes fn files list dirPath|
 
     fn := self asFilename.
     files := OrderedCollection new.
@@ -137,8 +137,9 @@
     attributes := self class attributes.
 
     fn isDirectory ifTrue:[
+        dirPath := fn pathName.
         attributes at:#requestDirectory put:true.
-        (DirectoryContents directoryNamed:fn pathName) filesDo:[:aFile|
+        (DirectoryContents directoryNamed:dirPath) filesDo:[:aFile|
             files add:aFile
         ].
     ] ifFalse:[
@@ -151,8 +152,9 @@
         (bName startsWith:'*') ifTrue:[
             files removeAll.
             fn := fn directory.
+            dirPath := fn pathName.
             attributes at:#requestDirectory put:true.
-            (DirectoryContents directoryNamed:fn pathName) filesDo:[:aFile|
+            (DirectoryContents directoryNamed:dirPath) filesDo:[:aFile|
                 files add:aFile
             ].
         ].
@@ -172,8 +174,13 @@
             attributes at:#baseName put:baseName.  
             (self pathSegements includes:baseName) ifTrue:[
                 attributes at:#uriInfo put:self.  
-            ] ifFalse:[
-                attributes at:#uriInfo put:((self copy) addComponent:baseName).  
+            ] ifFalse:[ |uri col|
+                uri := self copy.
+                col := self pathSegements copy.
+                col removeLast.
+                col add:baseName.
+                uri pathSegements:col.
+                attributes at:#uriInfo put:uri.  
             ].
             stream := aFile readStream.
             aBlock value:stream value:attributes.
@@ -256,5 +263,5 @@
 !FileURI class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/FileURI.st,v 1.4 2003-07-10 09:42:36 tm Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/FileURI.st,v 1.5 2003-07-10 12:07:29 tm Exp $'
 ! !