Filename.st
changeset 6983 c8c851f37aec
parent 6978 28e56617ff1f
child 6995 a7650ef2b1be
--- a/Filename.st	Wed Jan 29 20:23:17 2003 +0100
+++ b/Filename.st	Wed Jan 29 20:40:57 2003 +0100
@@ -2191,6 +2191,33 @@
     "Modified: / 23.12.1999 / 21:52:36 / cg"
 !
 
+createAsEmptyFile
+    "create an empty file with the receivers name.
+     Raises an exception if not successful
+    (either already existing or creation not possible)"
+
+    |writeStream|
+
+    self exists ifTrue:[
+        OperatingSystem accessDeniedErrorSignal
+            raiseRequestWith:self
+            errorString:(' - file exists: ' , self asString).
+        ^ self
+    ].  
+
+    FileStream openErrorSignal handle:[:ex|
+        self fileCreationError:self.
+        ^ self
+    ] do:[    
+        writeStream := self newReadWriteStream.
+    ].
+    writeStream isNil ifTrue:[
+        self fileCreationError:self.
+        ^ self
+    ].
+    writeStream close.
+!
+
 delete
     "remove the file - same as remove, for ST-80 compatibility"
 
@@ -4576,7 +4603,7 @@
 !Filename class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.237 2003-01-29 18:32:58 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.238 2003-01-29 19:40:57 cg Exp $'
 ! !
 
 Filename initialize!