PositionableStream.st
changeset 8318 6fd12ab774c0
parent 8053 4d37ece7b9f7
child 8320 229adaeaf183
--- a/PositionableStream.st	Thu Apr 15 15:19:49 2004 +0200
+++ b/PositionableStream.st	Thu Apr 15 15:44:11 2004 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -705,20 +703,27 @@
      return the value of the last chunk.
      Someone (which is usually some codeView) is notified of errors."
 
-    |oldPath val|
+    |oldPath val thisDirectory thisDirectoryPathName|
+
+    thisDirectory := aDirectory asFilename.
+    thisDirectoryPathName := thisDirectory pathName.
+    oldPath := Smalltalk systemPath.
 
     [   
-        |thisDirectory|
-
-        thisDirectory := aDirectory asFilename.
-
-        oldPath := Smalltalk systemPath.
-        Smalltalk systemPath:(oldPath copy addFirst:thisDirectory pathName; yourself).
+        Smalltalk systemPath:(oldPath copy addFirst:thisDirectoryPathName; yourself).
         CurrentFileInDirectoryQuerySignal answer:thisDirectory do:[
             val := self basicFileInNotifying:notifiedLoader passChunk:passChunk.
         ]
     ] ensure:[
-        Smalltalk systemPath:oldPath.
+        "take care, someone could have changed SystemPath during fileIn!!"
+        (Smalltalk systemPath copyFrom:2) = oldPath ifTrue:[
+            Smalltalk systemPath:oldPath.
+        ] ifFalse:[
+            (oldPath includes:thisDirectoryPathName) ifFalse:[
+                Smalltalk systemPath remove:thisDirectoryPathName ifAbsent:[].
+                Smalltalk flushPathCaches.
+            ].
+        ].
     ].
     ^ val
 !
@@ -1113,7 +1118,7 @@
 !PositionableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.138 2004-03-03 21:11:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.139 2004-04-15 13:44:11 stefan Exp $'
 ! !
 
 PositionableStream initialize!