FileStream.st
changeset 15479 7f6fdc8ff911
parent 15475 763fdc270fb8
child 15480 9a4e6bbb20d5
--- a/FileStream.st	Sat Jul 06 15:30:16 2013 +0200
+++ b/FileStream.st	Sat Jul 06 18:40:00 2013 +0200
@@ -294,6 +294,23 @@
 
 !FileStream class methodsFor:'instance creation'!
 
+newTemporaryIn:aDirectoryOrNil withSuffix:aSuffixString 
+    "create atomically a new file and return the file stream - use this for temporary files.
+     The created file is in aDirectoryPrefix and named 'stxtmp_xx_nn',
+     where xx is our unix process id, and nn is a unique number, incremented
+     with every call to this method."
+    
+    ^ self 
+        newTemporaryIn:aDirectoryOrNil
+        nameTemplate:(Filename tempFileNameTemplate asFilename 
+                                        withSuffix:aSuffixString) asString
+
+    "
+     FileStream newTemporaryWithSuffix:'txt'
+     FileStream newTemporaryIn:'/tmp' withSuffix:'txt'
+    "
+!
+
 appendingOldFileNamed:filename
     "return a FileStream for existing file named filename, aString.
      The file is opened for writeonly access."
@@ -819,7 +836,7 @@
 
     executor := super executor.
     removeOnClose == true ifTrue:[
-        executor pathName:pathName removeOnClose:true.
+        executor setPathName:pathName removeOnClose:true.
     ].
     ^ executor
 ! !
@@ -1766,11 +1783,6 @@
     "Modified: / 28.10.1997 / 14:28:54 / cg"
 !
 
-pathName:pathNameString removeOnClose:aBoolean
-    pathName := pathNameString.
-    removeOnClose := aBoolean.
-!
-
 reOpen
     "USERS WILL NEVER INVOKE THIS METHOD
      sent after snapin to reopen streams."
@@ -1814,6 +1826,11 @@
 
 setMode:aModeSymbol
     mode := aModeSymbol
+!
+
+setPathName:pathNameString removeOnClose:aBoolean
+    pathName := pathNameString.
+    removeOnClose := aBoolean.
 ! !
 
 !FileStream methodsFor:'private fileIn'!
@@ -1957,11 +1974,11 @@
 !FileStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.160 2013-07-05 13:53:13 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.161 2013-07-06 16:40:00 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.160 2013-07-05 13:53:13 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.161 2013-07-06 16:40:00 cg Exp $'
 ! !