--- a/Filename.st Thu Nov 21 16:03:39 2013 +0100
+++ b/Filename.st Thu Nov 21 16:04:00 2013 +0100
@@ -2802,7 +2802,12 @@
newNameAlreadyExists := newName exists.
outStream := newName writeStream.
newNameAlreadyExists ifFalse:[
- newName accessRights:self accessRights.
+ [
+ "would be nice to keep the access rights of the original test suite"
+ newName accessRights:self accessRights.
+ ] on:OperatingSystem accessDeniedErrorSignal do:[:ex|
+ "ignore the error - may occure when copying to a network drive"
+ ].
].
inStream binary.
outStream binary.
@@ -3297,7 +3302,8 @@
renameTo:newName
"rename the file - the argument must be convertable to a String.
- Raises an exception if not successful."
+ Raises an exception if not successful.
+ If newName already exists, it will be replaced by myself."
|errno|
@@ -3328,7 +3334,7 @@
The argument must be convertable to a filename.
Raises an exception, if an error occurs."
- |newName inStream newNameExists accessRights tempStream|
+ |newName inStream accessRights tempStream|
newName := newNameArg asFilename.
@@ -3336,8 +3342,7 @@
newName asAbsoluteFilename = self asAbsoluteFilename ifTrue: [ ^ self ].
inStream := self readStream.
- newNameExists := newName exists.
- newNameExists ifTrue:[
+ newName exists ifTrue:[
accessRights := newName accessRights.
] ifFalse:[
accessRights := self accessRights.
@@ -3346,7 +3351,12 @@
[
"let the temp filename start with a ~ to make it invisible"
tempStream := FileStream newTemporaryIn:newName directory nameTemplate:'~%1_%2'.
- tempStream accessRights:accessRights.
+ [
+ "would be nice to keep the access rights of the original test suite"
+ tempStream accessRights:accessRights.
+ ] on:OperatingSystem accessDeniedErrorSignal do:[:ex|
+ "ignore the error - may occure when copying to a network drive"
+ ].
inStream binary.
tempStream binary.
@@ -3355,12 +3365,10 @@
] on:Error do:[:ex|
^ self fileCreationError:newName
].
+ tempStream syncData.
] ensure:[
inStream close.
- tempStream notNil ifTrue:[tempStream syncData; close].
- ].
- newNameExists ifTrue:[
- newName remove.
+ tempStream notNil ifTrue:[tempStream close].
].
tempStream fileName renameTo:newName.
@@ -6058,11 +6066,11 @@
!Filename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.405 2013-11-20 19:05:42 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.406 2013-11-21 15:04:00 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.405 2013-11-20 19:05:42 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.406 2013-11-21 15:04:00 stefan Exp $'
! !