avoid unix-compat's rename
On Windows, that does not support long paths https://github.com/jacobstanley/unix-compat/issues/56 Instead, use System.Directory.renamePath, which does support long paths. Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
parent
bad39cadc6
commit
2d65c4ff1d
18 changed files with 75 additions and 20 deletions
|
@ -16,7 +16,7 @@ module Utility.Directory (
|
|||
|
||||
import Control.Monad
|
||||
import System.FilePath
|
||||
import System.PosixCompat.Files hiding (removeLink)
|
||||
import System.PosixCompat.Files (getSymbolicLinkStatus, isDirectory, isSymbolicLink)
|
||||
import Control.Applicative
|
||||
import System.IO.Unsafe (unsafeInterleaveIO)
|
||||
import Data.Maybe
|
||||
|
|
|
@ -16,7 +16,7 @@ module Utility.FileMode (
|
|||
import System.IO
|
||||
import Control.Monad
|
||||
import System.PosixCompat.Types
|
||||
import System.PosixCompat.Files hiding (removeLink)
|
||||
import System.PosixCompat.Files (unionFileModes, intersectFileModes, stdFileMode, nullFileMode, setFileCreationMask, groupReadMode, ownerReadMode, ownerWriteMode, ownerExecuteMode, groupWriteMode, groupExecuteMode, otherReadMode, otherWriteMode, otherExecuteMode, fileMode)
|
||||
import Control.Monad.IO.Class
|
||||
import Foreign (complement)
|
||||
import Control.Monad.Catch
|
||||
|
|
|
@ -14,7 +14,7 @@ module Utility.FileSize (
|
|||
getFileSize',
|
||||
) where
|
||||
|
||||
import System.PosixCompat.Files hiding (removeLink)
|
||||
import System.PosixCompat.Files (FileStatus, fileSize)
|
||||
import qualified Utility.RawFilePath as R
|
||||
#ifdef mingw32_HOST_OS
|
||||
import Control.Exception (bracket)
|
||||
|
|
|
@ -18,6 +18,7 @@ module Utility.LogFile (
|
|||
) where
|
||||
|
||||
import Common
|
||||
import Utility.RawFilePath
|
||||
|
||||
#ifndef mingw32_HOST_OS
|
||||
import System.Posix.Types
|
||||
|
@ -36,7 +37,7 @@ rotateLog logfile = go 0
|
|||
| num > maxLogs = return ()
|
||||
| otherwise = whenM (doesFileExist currfile) $ do
|
||||
go (num + 1)
|
||||
rename currfile nextfile
|
||||
rename (toRawFilePath currfile) (toRawFilePath nextfile)
|
||||
where
|
||||
currfile = filename num
|
||||
nextfile = filename (num + 1)
|
||||
|
|
|
@ -89,6 +89,8 @@ createDirectory = D.createDirectory . fromRawFilePath
|
|||
setFileMode :: RawFilePath -> FileMode -> IO ()
|
||||
setFileMode = F.setFileMode . fromRawFilePath
|
||||
|
||||
{- Using renamePath rather than the rename provided in unix-compat
|
||||
- because of this bug https://github.com/jacobstanley/unix-compat/issues/56-}
|
||||
rename :: RawFilePath -> RawFilePath -> IO ()
|
||||
rename a b = F.rename (fromRawFilePath a) (fromRawFilePath b)
|
||||
rename a b = D.renamePath (fromRawFilePath a) (fromRawFilePath b)
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,7 @@ import Utility.Data
|
|||
import Control.Applicative
|
||||
#endif
|
||||
|
||||
import System.PosixCompat
|
||||
import System.PosixCompat.User
|
||||
import Prelude
|
||||
|
||||
{- Current user's home directory.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue