Skip to content

Directory.renameFile broken under windows

According to the library report, renameFile should succed 
even if the target file already exists. Under windows it 
fails with:
 
Fail: already exists
Action: renameFile
Reason: File exists
File: foo

(ghc 6.0 and 6.0.1)

The reason seems to be that it uses the rename library 
call directly, which indeed fails if the target exists:

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/vclib/html/_crt_rename.2c_._wrename.asp

A solution might involve MoveFileEx(old, new, 
MOVEFILE_REPLACE_EXISTING) ?
Trac metadata
Trac field Value
Version 6.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedFixed
Component hslibs/posix
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information