get rid of __WINDOWS__, use mingw32_HOST_OS

The latter is harder for me to remember, but avoids build failures in code
used by the configure program.
This commit is contained in:
Joey Hess 2013-08-02 12:27:32 -04:00
parent 022c3910e9
commit 93f2371e09
24 changed files with 55 additions and 55 deletions

View file

@ -92,14 +92,14 @@ inAnnexSafe = inAnnex' (fromMaybe False) (Just False) go
where where
go f = liftIO $ openforlock f >>= check go f = liftIO $ openforlock f >>= check
openforlock f = catchMaybeIO $ openforlock f = catchMaybeIO $
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
openFd f ReadOnly Nothing defaultFileFlags openFd f ReadOnly Nothing defaultFileFlags
#else #else
return () return ()
#endif #endif
check Nothing = return is_missing check Nothing = return is_missing
check (Just h) = do check (Just h) = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
v <- getLock h (ReadLock, AbsoluteSeek, 0, 0) v <- getLock h (ReadLock, AbsoluteSeek, 0, 0)
closeFd h closeFd h
return $ case v of return $ case v of
@ -116,7 +116,7 @@ inAnnexSafe = inAnnex' (fromMaybe False) (Just False) go
- it. (If the content is not present, no locking is done.) -} - it. (If the content is not present, no locking is done.) -}
lockContent :: Key -> Annex a -> Annex a lockContent :: Key -> Annex a -> Annex a
lockContent key a = do lockContent key a = do
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
a a
#else #else
file <- calcRepo $ gitAnnexLocation key file <- calcRepo $ gitAnnexLocation key

View file

@ -34,7 +34,7 @@ checkEnvironment = do
checkEnvironmentIO :: IO () checkEnvironmentIO :: IO ()
checkEnvironmentIO = checkEnvironmentIO =
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
noop noop
#else #else
whenM (null <$> myUserGecos) $ do whenM (null <$> myUserGecos) $ do

View file

@ -87,7 +87,7 @@ lockJournal a = do
bracketIO (lock lockfile mode) unlock (const a) bracketIO (lock lockfile mode) unlock (const a)
where where
lock lockfile mode = do lock lockfile mode = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
l <- noUmask mode $ createFile lockfile mode l <- noUmask mode $ createFile lockfile mode
waitToSetLock l (WriteLock, AbsoluteSeek, 0, 0) waitToSetLock l (WriteLock, AbsoluteSeek, 0, 0)
return l return l
@ -95,7 +95,7 @@ lockJournal a = do
writeFile lockfile "" writeFile lockfile ""
return lockfile return lockfile
#endif #endif
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
unlock = closeFd unlock = closeFd
#else #else
unlock = removeFile unlock = removeFile

View file

@ -22,7 +22,7 @@ lockFile file = go =<< fromPool file
where where
go (Just _) = noop -- already locked go (Just _) = noop -- already locked
go Nothing = do go Nothing = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
mode <- annexFileMode mode <- annexFileMode
fd <- liftIO $ noUmask mode $ fd <- liftIO $ noUmask mode $
openFd file ReadOnly (Just mode) defaultFileFlags openFd file ReadOnly (Just mode) defaultFileFlags
@ -37,7 +37,7 @@ unlockFile :: FilePath -> Annex ()
unlockFile file = maybe noop go =<< fromPool file unlockFile file = maybe noop go =<< fromPool file
where where
go fd = do go fd = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
liftIO $ closeFd fd liftIO $ closeFd fd
#endif #endif
changePool $ M.delete file changePool $ M.delete file

View file

@ -98,7 +98,7 @@ sshCleanup = go =<< sshCacheDir
liftIO (catchDefaultIO [] $ dirContents dir) liftIO (catchDefaultIO [] $ dirContents dir)
forM_ sockets cleanup forM_ sockets cleanup
cleanup socketfile = do cleanup socketfile = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
-- Drop any shared lock we have, and take an -- Drop any shared lock we have, and take an
-- exclusive lock, without blocking. If the lock -- exclusive lock, without blocking. If the lock
-- succeeds, nothing is using this ssh, and it can -- succeeds, nothing is using this ssh, and it can

View file

@ -25,7 +25,7 @@ supportedVersions :: [Version]
supportedVersions = [defaultVersion, directModeVersion] supportedVersions = [defaultVersion, directModeVersion]
upgradableVersions :: [Version] upgradableVersions :: [Version]
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
upgradableVersions = ["0", "1", "2"] upgradableVersions = ["0", "1", "2"]
#else #else
upgradableVersions = ["2"] upgradableVersions = ["2"]

View file

@ -35,7 +35,7 @@ import Utility.HumanTime
import Git.FilePath import Git.FilePath
import GitAnnex.Options import GitAnnex.Options
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
import System.Posix.Process (getProcessID) import System.Posix.Process (getProcessID)
#else #else
import System.Random (getStdRandom, random) import System.Random (getStdRandom, random)
@ -151,7 +151,7 @@ performRemote key file backend numcopies remote =
, checkKeyNumCopies key file numcopies , checkKeyNumCopies key file numcopies
] ]
withtmp a = do withtmp a = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
v <- liftIO getProcessID v <- liftIO getProcessID
#else #else
v <- liftIO (getStdRandom random :: IO Int) v <- liftIO (getStdRandom random :: IO Int)
@ -458,7 +458,7 @@ recordFsckTime key = do
parent <- parentDir <$> calcRepo (gitAnnexLocation key) parent <- parentDir <$> calcRepo (gitAnnexLocation key)
liftIO $ void $ tryIO $ do liftIO $ void $ tryIO $ do
touchFile parent touchFile parent
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
setSticky parent setSticky parent
#endif #endif

View file

@ -66,7 +66,7 @@ cleanupIndirect file key = do
) )
return True return True
where where
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
goFast = go goFast = go
#else #else
goFast = do goFast = do

View file

@ -25,7 +25,7 @@ module Git.Construct (
{-# LANGUAGE CPP #-} {-# LANGUAGE CPP #-}
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
import System.Posix.User import System.Posix.User
#else #else
import Git.FilePath import Git.FilePath
@ -146,7 +146,7 @@ fromRemoteLocation :: String -> Repo -> IO Repo
fromRemoteLocation s repo = gen $ calcloc s fromRemoteLocation s repo = gen $ calcloc s
where where
gen v gen v
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
| dosstyle v = fromRemotePath (dospath v) repo | dosstyle v = fromRemotePath (dospath v) repo
#endif #endif
| scpstyle v = fromUrl $ scptourl v | scpstyle v = fromUrl $ scptourl v
@ -182,7 +182,7 @@ fromRemoteLocation s repo = gen $ calcloc s
| "/" `isPrefixOf` d = d | "/" `isPrefixOf` d = d
| "~" `isPrefixOf` d = '/':d | "~" `isPrefixOf` d = '/':d
| otherwise = "/~/" ++ d | otherwise = "/~/" ++ d
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
-- git on Windows will write a path to .git/config with "drive:", -- git on Windows will write a path to .git/config with "drive:",
-- which is not to be confused with a "host:" -- which is not to be confused with a "host:"
dosstyle = hasDrive dosstyle = hasDrive
@ -208,7 +208,7 @@ repoAbsPath d = do
return $ h </> d' return $ h </> d'
expandTilde :: FilePath -> IO FilePath expandTilde :: FilePath -> IO FilePath
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
expandTilde = return expandTilde = return
#else #else
expandTilde = expandt True expandTilde = expandt True

View file

@ -41,7 +41,7 @@ get = do
return $ addworktree wt r return $ addworktree wt r
where where
pathenv s = do pathenv s = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
v <- getEnv s v <- getEnv s
case v of case v of
Just d -> do Just d -> do

View file

@ -44,14 +44,14 @@ asTopFilePath file = TopFilePath file
type InternalGitPath = String type InternalGitPath = String
toInternalGitPath :: FilePath -> InternalGitPath toInternalGitPath :: FilePath -> InternalGitPath
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
toInternalGitPath = id toInternalGitPath = id
#else #else
toInternalGitPath = replace "\\" "/" toInternalGitPath = replace "\\" "/"
#endif #endif
fromInternalGitPath :: InternalGitPath -> FilePath fromInternalGitPath :: InternalGitPath -> FilePath
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
fromInternalGitPath = id fromInternalGitPath = id
#else #else
fromInternalGitPath = replace "/" "\\" fromInternalGitPath = replace "/" "\\"

View file

@ -130,7 +130,7 @@ runTransfer t file shouldretry a = do
return ok return ok
where where
prep tfile mode info = do prep tfile mode info = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
mfd <- catchMaybeIO $ mfd <- catchMaybeIO $
openFd (transferLockFile tfile) ReadWrite (Just mode) openFd (transferLockFile tfile) ReadWrite (Just mode)
defaultFileFlags { trunc = True } defaultFileFlags { trunc = True }
@ -154,7 +154,7 @@ runTransfer t file shouldretry a = do
cleanup tfile (Just fd) = do cleanup tfile (Just fd) = do
void $ tryIO $ removeFile tfile void $ tryIO $ removeFile tfile
void $ tryIO $ removeFile $ transferLockFile tfile void $ tryIO $ removeFile $ transferLockFile tfile
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
closeFd fd closeFd fd
#endif #endif
retry oldinfo metervar run = do retry oldinfo metervar run = do
@ -214,7 +214,7 @@ startTransferInfo file = TransferInfo
checkTransfer :: Transfer -> Annex (Maybe TransferInfo) checkTransfer :: Transfer -> Annex (Maybe TransferInfo)
checkTransfer t = do checkTransfer t = do
tfile <- fromRepo $ transferFile t tfile <- fromRepo $ transferFile t
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
mode <- annexFileMode mode <- annexFileMode
mfd <- liftIO $ catchMaybeIO $ mfd <- liftIO $ catchMaybeIO $
openFd (transferLockFile tfile) ReadOnly (Just mode) defaultFileFlags openFd (transferLockFile tfile) ReadOnly (Just mode) defaultFileFlags

View file

@ -219,7 +219,7 @@ retrieveEncrypted d chunksize (cipher, enck) k f p = metered (Just p) k $ \meter
retrieveCheap :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool retrieveCheap :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool
retrieveCheap _ (Just _) _ _ = return False -- no cheap retrieval for chunks retrieveCheap _ (Just _) _ _ = return False -- no cheap retrieval for chunks
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
retrieveCheap d _ k f = liftIO $ withStoredFiles Nothing d k go retrieveCheap d _ k f = liftIO $ withStoredFiles Nothing d k go
where where
go [file] = catchBoolIO $ createSymbolicLink file f >> return True go [file] = catchBoolIO $ createSymbolicLink file f >> return True

View file

@ -267,7 +267,7 @@ keyUrls :: Git.Repo -> Key -> [String]
keyUrls r key = map tourl locs keyUrls r key = map tourl locs
where where
tourl l = Git.repoLocation r ++ "/" ++ l tourl l = Git.repoLocation r ++ "/" ++ l
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
locs = annexLocations key locs = annexLocations key
#else #else
locs = map (replace "\\" "/") (annexLocations key) locs = map (replace "\\" "/") (annexLocations key)
@ -361,7 +361,7 @@ copyFromRemote' r key file dest
copyFromRemoteCheap :: Remote -> Key -> FilePath -> Annex Bool copyFromRemoteCheap :: Remote -> Key -> FilePath -> Annex Bool
copyFromRemoteCheap r key file copyFromRemoteCheap r key file
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) False $ do | not $ Git.repoIsUrl (repo r) = guardUsable (repo r) False $ do
loc <- liftIO $ gitAnnexLocation key (repo r) $ loc <- liftIO $ gitAnnexLocation key (repo r) $
fromJust $ remoteGitConfig $ gitconfig r fromJust $ remoteGitConfig $ gitconfig r
@ -418,7 +418,7 @@ rsyncHelper callback params = do
- filesystem. Then cp could be faster. -} - filesystem. Then cp could be faster. -}
rsyncOrCopyFile :: [CommandParam] -> FilePath -> FilePath -> MeterUpdate -> Annex Bool rsyncOrCopyFile :: [CommandParam] -> FilePath -> FilePath -> MeterUpdate -> Annex Bool
rsyncOrCopyFile rsyncparams src dest p = rsyncOrCopyFile rsyncparams src dest p =
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
dorsync dorsync
where where
#else #else

View file

@ -11,7 +11,7 @@ module Remote.Rsync (remote) where
import qualified Data.ByteString.Lazy as L import qualified Data.ByteString.Lazy as L
import qualified Data.Map as M import qualified Data.Map as M
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
import System.Posix.Process (getProcessID) import System.Posix.Process (getProcessID)
#else #else
import System.Random (getStdRandom, random) import System.Random (getStdRandom, random)
@ -221,7 +221,7 @@ sendParams = ifM crippledFileSystem
- up trees for rsync. -} - up trees for rsync. -}
withRsyncScratchDir :: (FilePath -> Annex Bool) -> Annex Bool withRsyncScratchDir :: (FilePath -> Annex Bool) -> Annex Bool
withRsyncScratchDir a = do withRsyncScratchDir a = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
v <- liftIO getProcessID v <- liftIO getProcessID
#else #else
v <- liftIO (getStdRandom random :: IO Int) v <- liftIO (getStdRandom random :: IO Int)

View file

@ -88,6 +88,6 @@ rawMode ch = do
where where
raw h = do raw h = do
fileEncoding h fileEncoding h
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
hSetNewlineMode h noNewlineTranslation hSetNewlineMode h noNewlineTranslation
#endif #endif

View file

@ -36,7 +36,7 @@ copyFileExternal src dest = do
{- Create a hard link if the filesystem allows it, and fall back to copying {- Create a hard link if the filesystem allows it, and fall back to copying
- the file. -} - the file. -}
createLinkOrCopy :: FilePath -> FilePath -> IO Bool createLinkOrCopy :: FilePath -> FilePath -> IO Bool
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
createLinkOrCopy src dest = go `catchIO` const fallback createLinkOrCopy src dest = go `catchIO` const fallback
where where
go = do go = do

View file

@ -12,7 +12,7 @@ module Utility.Daemon where
import Common import Common
import Utility.LogFile import Utility.LogFile
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
import System.Posix import System.Posix
#else #else
import System.PosixCompat import System.PosixCompat
@ -26,7 +26,7 @@ import System.Posix.Types
- -
- When successful, does not return. -} - When successful, does not return. -}
daemonize :: Fd -> Maybe FilePath -> Bool -> IO () -> IO () daemonize :: Fd -> Maybe FilePath -> Bool -> IO () -> IO ()
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
daemonize logfd pidfile changedirectory a = do daemonize logfd pidfile changedirectory a = do
maybe noop checkalreadyrunning pidfile maybe noop checkalreadyrunning pidfile
_ <- forkProcess child1 _ <- forkProcess child1
@ -58,7 +58,7 @@ daemonize = error "daemonize is not implemented on Windows" -- TODO
lockPidFile :: FilePath -> IO () lockPidFile :: FilePath -> IO ()
lockPidFile file = do lockPidFile file = do
createDirectoryIfMissing True (parentDir file) createDirectoryIfMissing True (parentDir file)
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
fd <- openFd file ReadWrite (Just stdFileMode) defaultFileFlags fd <- openFd file ReadWrite (Just stdFileMode) defaultFileFlags
locked <- catchMaybeIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0) locked <- catchMaybeIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
fd' <- openFd newfile ReadWrite (Just stdFileMode) defaultFileFlags fd' <- openFd newfile ReadWrite (Just stdFileMode) defaultFileFlags
@ -85,7 +85,7 @@ alreadyRunning = error "Daemon is already running."
- -
- If it's running, returns its pid. -} - If it's running, returns its pid. -}
checkDaemon :: FilePath -> IO (Maybe ProcessID) checkDaemon :: FilePath -> IO (Maybe ProcessID)
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
checkDaemon pidfile = do checkDaemon pidfile = do
v <- catchMaybeIO $ v <- catchMaybeIO $
openFd pidfile ReadOnly (Just stdFileMode) defaultFileFlags openFd pidfile ReadOnly (Just stdFileMode) defaultFileFlags
@ -110,7 +110,7 @@ checkDaemon pidfile = maybe Nothing readish <$> catchMaybeIO (readFile pidfile)
{- Stops the daemon, safely. -} {- Stops the daemon, safely. -}
stopDaemon :: FilePath -> IO () stopDaemon :: FilePath -> IO ()
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
stopDaemon pidfile = go =<< checkDaemon pidfile stopDaemon pidfile = go =<< checkDaemon pidfile
where where
go Nothing = noop go Nothing = noop

View file

@ -13,7 +13,7 @@ import Common
import Control.Exception (bracket) import Control.Exception (bracket)
import System.PosixCompat.Types import System.PosixCompat.Types
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
import System.Posix.Files import System.Posix.Files
#endif #endif
import Foreign (complement) import Foreign (complement)
@ -76,7 +76,7 @@ checkMode checkfor mode = checkfor `intersectFileModes` mode == checkfor
{- Checks if a file mode indicates it's a symlink. -} {- Checks if a file mode indicates it's a symlink. -}
isSymLink :: FileMode -> Bool isSymLink :: FileMode -> Bool
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
isSymLink _ = False isSymLink _ = False
#else #else
isSymLink = checkMode symbolicLinkMode isSymLink = checkMode symbolicLinkMode
@ -89,7 +89,7 @@ isExecutable mode = combineModes executeModes `intersectFileModes` mode /= 0
{- Runs an action without that pesky umask influencing it, unless the {- Runs an action without that pesky umask influencing it, unless the
- passed FileMode is the standard one. -} - passed FileMode is the standard one. -}
noUmask :: FileMode -> IO a -> IO a noUmask :: FileMode -> IO a -> IO a
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
noUmask mode a noUmask mode a
| mode == stdFileMode = a | mode == stdFileMode = a
| otherwise = bracket setup cleanup go | otherwise = bracket setup cleanup go
@ -107,7 +107,7 @@ combineModes [m] = m
combineModes (m:ms) = foldl unionFileModes m ms combineModes (m:ms) = foldl unionFileModes m ms
isSticky :: FileMode -> Bool isSticky :: FileMode -> Bool
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
isSticky _ = False isSticky _ = False
#else #else
isSticky = checkMode stickyMode isSticky = checkMode stickyMode

View file

@ -29,7 +29,7 @@ gpgcmd = fromMaybe "gpg" SysConfig.gpg
stdParams :: [CommandParam] -> IO [String] stdParams :: [CommandParam] -> IO [String]
stdParams params = do stdParams params = do
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
-- Enable batch mode if GPG_AGENT_INFO is set, to avoid extraneous -- Enable batch mode if GPG_AGENT_INFO is set, to avoid extraneous
-- gpg output about password prompts. GPG_BATCH is set by the test -- gpg output about password prompts. GPG_BATCH is set by the test
-- suite for a similar reason. -- suite for a similar reason.
@ -77,7 +77,7 @@ pipeStrict params input = do
- Note that to avoid deadlock with the cleanup stage, - Note that to avoid deadlock with the cleanup stage,
- the reader must fully consume gpg's input before returning. -} - the reader must fully consume gpg's input before returning. -}
feedRead :: [CommandParam] -> String -> (Handle -> IO ()) -> (Handle -> IO a) -> IO a feedRead :: [CommandParam] -> String -> (Handle -> IO ()) -> (Handle -> IO a) -> IO a
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
feedRead params passphrase feeder reader = do feedRead params passphrase feeder reader = do
-- pipe the passphrase into gpg on a fd -- pipe the passphrase into gpg on a fd
(frompipe, topipe) <- createPipe (frompipe, topipe) <- createPipe

View file

@ -14,7 +14,7 @@ import Common
import System.Posix.Types import System.Posix.Types
openLog :: FilePath -> IO Fd openLog :: FilePath -> IO Fd
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
openLog logfile = do openLog logfile = do
rotateLog logfile rotateLog logfile
openFd logfile WriteOnly (Just stdFileMode) openFd logfile WriteOnly (Just stdFileMode)
@ -50,7 +50,7 @@ maxLogs :: Int
maxLogs = 9 maxLogs = 9
redirLog :: Fd -> IO () redirLog :: Fd -> IO ()
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
redirLog logfd = do redirLog logfd = do
mapM_ (redir logfd) [stdOutput, stdError] mapM_ (redir logfd) [stdOutput, stdError]
closeFd logfd closeFd logfd
@ -58,7 +58,7 @@ redirLog logfd = do
redirLog _ = error "redirLog TODO" redirLog _ = error "redirLog TODO"
#endif #endif
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
redir :: Fd -> Fd -> IO () redir :: Fd -> Fd -> IO ()
redir newh h = do redir newh h = do
closeFd h closeFd h

View file

@ -16,7 +16,7 @@ import Data.List
import Data.Maybe import Data.Maybe
import Control.Applicative import Control.Applicative
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
import Data.Char import Data.Char
import qualified System.FilePath.Posix as Posix import qualified System.FilePath.Posix as Posix
#else #else
@ -38,7 +38,7 @@ import Utility.UserInfo
- no normalization is done. - no normalization is done.
-} -}
absNormPath :: FilePath -> FilePath -> Maybe FilePath absNormPath :: FilePath -> FilePath -> Maybe FilePath
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
absNormPath dir path = MissingH.absNormPath dir path absNormPath dir path = MissingH.absNormPath dir path
#else #else
absNormPath dir path = Just $ combine dir path absNormPath dir path = Just $ combine dir path
@ -183,7 +183,7 @@ searchPath command
where where
indir d = check $ d </> command indir d = check $ d </> command
check f = firstM doesFileExist check f = firstM doesFileExist
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
[f, f ++ ".exe"] [f, f ++ ".exe"]
#else #else
[f] [f]
@ -203,7 +203,7 @@ dotfile file
{- Converts a DOS style path to a Cygwin style path. Only on Windows. {- Converts a DOS style path to a Cygwin style path. Only on Windows.
- Any trailing '\' is preserved as a trailing '/' -} - Any trailing '\' is preserved as a trailing '/' -}
toCygPath :: FilePath -> FilePath toCygPath :: FilePath -> FilePath
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
toCygPath = id toCygPath = id
#else #else
toCygPath p toCygPath p
@ -226,7 +226,7 @@ toCygPath p
- limit. - limit.
-} -}
fileNameLengthLimit :: FilePath -> IO Int fileNameLengthLimit :: FilePath -> IO Int
#ifdef __WINDOWS__ #ifdef mingw32_HOST_OS
fileNameLengthLimit _ = return 255 fileNameLengthLimit _ = return 255
#else #else
fileNameLengthLimit dir = do fileNameLengthLimit dir = do

View file

@ -13,7 +13,7 @@ module Utility.ThreadScheduler where
import Common import Common
import Control.Concurrent import Control.Concurrent
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
import System.Posix.Signals import System.Posix.Signals
#ifndef __ANDROID__ #ifndef __ANDROID__
import System.Posix.Terminal import System.Posix.Terminal
@ -54,7 +54,7 @@ unboundDelay time = do
waitForTermination :: IO () waitForTermination :: IO ()
waitForTermination = do waitForTermination = do
lock <- newEmptyMVar lock <- newEmptyMVar
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
let check sig = void $ let check sig = void $
installHandler sig (CatchOnce $ putMVar lock ()) Nothing installHandler sig (CatchOnce $ putMVar lock ()) Nothing
check softwareTermination check softwareTermination

View file

@ -24,7 +24,7 @@ import Utility.Env
myHomeDir :: IO FilePath myHomeDir :: IO FilePath
myHomeDir = myVal env homeDirectory myHomeDir = myVal env homeDirectory
where where
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
env = ["HOME"] env = ["HOME"]
#else #else
env = ["USERPROFILE", "HOME"] -- HOME is used in Cygwin env = ["USERPROFILE", "HOME"] -- HOME is used in Cygwin
@ -34,7 +34,7 @@ myHomeDir = myVal env homeDirectory
myUserName :: IO String myUserName :: IO String
myUserName = myVal env userName myUserName = myVal env userName
where where
#ifndef __WINDOWS__ #ifndef mingw32_HOST_OS
env = ["USER", "LOGNAME"] env = ["USER", "LOGNAME"]
#else #else
env = ["USERNAME", "USER", "LOGNAME"] env = ["USERNAME", "USER", "LOGNAME"]