Windows: Avoid using unix-compat's rename, which refuses to rename directories.
Opened a bug about this: https://github.com/jystic/unix-compat/issues/10
This commit is contained in:
parent
4b37bc6493
commit
1669e80e85
17 changed files with 35 additions and 22 deletions
30
Utility/PosixFiles.hs
Normal file
30
Utility/PosixFiles.hs
Normal file
|
@ -0,0 +1,30 @@
|
|||
{- POSIX files (and compatablity wrappers).
|
||||
-
|
||||
- This is like System.PosixCompat.Files, except with a fixed rename.
|
||||
-
|
||||
- Copyright 2014 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
{-# LANGUAGE CPP #-}
|
||||
|
||||
module Utility.PosixFiles (
|
||||
module X,
|
||||
rename
|
||||
) where
|
||||
|
||||
import System.PosixCompat.Files as X hiding (rename)
|
||||
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Files (rename)
|
||||
#else
|
||||
import System.Win32.File (moveFile)
|
||||
#endif
|
||||
|
||||
{- System.PosixCompat.Files.rename on Windows calls renameFile,
|
||||
- so cannot rename directories. Instead, use Win32 moveFile, which can. -}
|
||||
#ifdef mingw32_HOST_OS
|
||||
rename :: FilePath -> FilePath -> IO ()
|
||||
rename = moveFile
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue