Fix newTempDir
on Windows
This commit is contained in:
parent
ff75811a76
commit
1797a53800
@ -14,7 +14,7 @@ import Control.Exception.IOChoice ((||>))
|
|||||||
import Control.Monad (filterM)
|
import Control.Monad (filterM)
|
||||||
import Data.List (isSuffixOf)
|
import Data.List (isSuffixOf)
|
||||||
import System.Directory (getCurrentDirectory, getDirectoryContents, doesFileExist, getTemporaryDirectory, removeDirectoryRecursive)
|
import System.Directory (getCurrentDirectory, getDirectoryContents, doesFileExist, getTemporaryDirectory, removeDirectoryRecursive)
|
||||||
import System.FilePath ((</>), takeDirectory)
|
import System.FilePath ((</>),takeDirectory,pathSeparators,splitDrive)
|
||||||
import System.IO.Temp
|
import System.IO.Temp
|
||||||
|
|
||||||
|
|
||||||
@ -34,8 +34,9 @@ newTempDir :: FilePath -> IO FilePath
|
|||||||
newTempDir dir =
|
newTempDir dir =
|
||||||
flip createTempDirectory uniqPathName =<< getTemporaryDirectory
|
flip createTempDirectory uniqPathName =<< getTemporaryDirectory
|
||||||
where
|
where
|
||||||
uniqPathName = "ghc-mod" ++ map escapeSlash dir
|
uniqPathName = "ghc-mod" ++ map escapeSlash (snd $ splitDrive dir)
|
||||||
escapeSlash '/' = '-'
|
|
||||||
|
escapeSlash c | c `elem` pathSeparators = '-'
|
||||||
escapeSlash c = c
|
escapeSlash c = c
|
||||||
|
|
||||||
cleanupCradle :: Cradle -> IO ()
|
cleanupCradle :: Cradle -> IO ()
|
||||||
|
Loading…
Reference in New Issue
Block a user