<HTML>
<HEAD>
<TITLE>[Q] What is the reason for raise one error trying to save a new file ? </TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana">I copy from image and this code perhaps belongs to Tim Rowledge .<BR>
I not could figure why you choose raise one error if file do not exist.<BR>
It’s not what we wish to do using this method ?<BR>
<BR>
forceNewFileNamed: fileName <BR>
"Create a new file with the given name, and answer a stream opened <BR>
for writing on that file. If the file already exists, delete it without <BR>
asking before creating the new file."<BR>
| dir localName fullName f |<BR>
fullName := self fullName: fileName.<BR>
(self isAFileNamed: fullName)<BR>
ifFalse: [f := self new open: fullName forWrite: true.<BR>
^ f isNil<BR>
ifTrue: ["Failed to open the file"<BR>
(FileDoesNotExistException fileName: fullName) signal]<BR>
ifFalse: [f]].<BR>
dir := FileDirectory forFileName: fullName.<BR>
localName := FileDirectory localNameFor: fullName.<BR>
dir<BR>
deleteFileNamed: localName<BR>
ifAbsent: [(CannotDeleteFileException new<BR>
messageText: 'Could not delete the old version of file ' , fullName) signal].<BR>
f := self new open: fullName forWrite: true.<BR>
^ f isNil<BR>
ifTrue: ["Failed to open the file"<BR>
(FileDoesNotExistException fileName: fullName) signal]<BR>
ifFalse: [f]<BR>
<BR>
Cheers and continue good work on TK4.<BR>
<BR>
Edgar, Advocatus Diaboli</FONT>
</BODY>
</HTML>