tell moveFile to overwrite existing files
This commit is contained in:
parent
1ad3c1b2b3
commit
e40a119e74
1 changed files with 6 additions and 3 deletions
|
@ -19,12 +19,15 @@ import System.PosixCompat.Files as X hiding (rename)
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
import System.Posix.Files (rename)
|
import System.Posix.Files (rename)
|
||||||
#else
|
#else
|
||||||
import System.Win32.File (moveFile)
|
import qualified System.Win32.File as Win32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{- System.PosixCompat.Files.rename on Windows calls renameFile,
|
{- System.PosixCompat.Files.rename on Windows calls renameFile,
|
||||||
- so cannot rename directories. Instead, use Win32 moveFile, which can. -}
|
- so cannot rename directories.
|
||||||
|
-
|
||||||
|
- Instead, use Win32 moveFile, which can. It needs to be told to overwrite
|
||||||
|
- any existing file. -}
|
||||||
#ifdef mingw32_HOST_OS
|
#ifdef mingw32_HOST_OS
|
||||||
rename :: FilePath -> FilePath -> IO ()
|
rename :: FilePath -> FilePath -> IO ()
|
||||||
rename = moveFile
|
rename src dest = Win32.moveFileEx src dest Win32.mOVEFILE_REPLACE_EXISTING
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue