--- a/Filename.st Thu Jul 04 21:34:59 2013 +0200
+++ b/Filename.st Fri Jul 05 01:07:48 2013 +0200
@@ -2816,6 +2816,51 @@
"Modified: / 29-09-2006 / 16:26:32 / cg"
!
+copyToStream:outStream
+ "Copy the files contents into another file.
+ The argument must be convertable to a filename.
+ Raises an exception, if an error occurs."
+
+ |newName inStream resetBinary|
+
+ "Contents is not copied if newName represent same file as me."
+ outStream isFileStream ifTrue:[
+ outStream fileName asAbsoluteFilename = self asAbsoluteFilename ifTrue: [ ^ self ].
+ ].
+
+ inStream := self readStream.
+ inStream isNil ifTrue:[
+ ^ self fileNotFoundError:self
+ ].
+
+ [
+ inStream binary.
+ resetBinary := false.
+ outStream isBinary ifFalse:[
+ outStream binary.
+ resetBinary := true.
+ ].
+
+ [
+ inStream copyToEndInto:outStream.
+ ] on:Error do:[:ex|
+ ^ self fileCreationError:newName
+ ]
+ ] ensure:[
+ inStream close.
+ resetBinary ifTrue:[
+ outStream text.
+ ].
+ ].
+
+ "
+ |out|
+ out := FileStream newTemporary.
+ 'Make.proto' asFilename copyToStream:out.
+ out reset; contents
+ "
+!
+
createAsEmptyFile
"create an empty file with the receivers name.
Raises an exception if not successful
@@ -5947,11 +5992,11 @@
!Filename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.399 2013-07-04 16:31:30 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.400 2013-07-04 23:07:48 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.399 2013-07-04 16:31:30 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.400 2013-07-04 23:07:48 stefan Exp $'
! !