FileStream.st
changeset 11437 7869fd22df88
parent 11290 4226ed9c9a94
child 11454 b451c165163a
--- a/FileStream.st	Tue Jan 13 14:00:26 2009 +0100
+++ b/FileStream.st	Tue Jan 13 15:46:42 2009 +0100
@@ -547,6 +547,13 @@
     ^ pathName asFilename directoryName
 !
 
+fileName
+    "return the file name - same as pathName for compatibility with
+     other smalltalks"
+
+    ^ pathName asFilename
+!
+
 name
     "return my name without leading direcory-path (i.e. the plain fileName)
      as a string"
@@ -818,6 +825,25 @@
     ]
 !
 
+reset
+    "additionaly to setting the position to the beginning of the file,
+     re-open a previously closed file. This behavior is compatible
+     with other Smalltalk dialects"
+
+    filePointer isNil ifTrue:[
+        "reopen the file"
+        mode == #readonly ifTrue: [
+            self openForReading
+        ] ifFalse:[mode == #writeonly ifTrue: [
+            self openForWriting.
+        ] ifFalse:[
+            self openForReadWrite.
+        ]].
+    ] ifFalse:[
+        super reset.
+    ].
+!
+
 setToEnd
     "set the read/write position in the file to be at the end of the file"
 
@@ -1535,7 +1561,7 @@
 !FileStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.129 2008-10-30 15:31:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.130 2009-01-13 14:46:42 stefan Exp $'
 ! !
 
 FileStream initialize!