File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -768,12 +768,6 @@ isOwnedByUser path = liftIO $ do
768768 fileStatus <- getFileStatus (toFilePath path)
769769 user <- getEffectiveUserID
770770 return (user == fileOwner fileStatus)
771- where
772- #ifdef WINDOWS
773- osIsWindows = True
774- #else
775- osIsWindows = False
776- #endif
777771
778772-- | 'True' if we are currently running inside a Docker container.
779773getInContainer :: (MonadIO m ) => m Bool
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE CPP #-}
12{-# LANGUAGE NoImplicitPrelude #-}
23{-# LANGUAGE OverloadedStrings #-}
34{-# LANGUAGE TemplateHaskell #-}
@@ -32,6 +33,7 @@ module Stack.Constants
3233 ,minTerminalWidth
3334 ,maxTerminalWidth
3435 ,defaultTerminalWidth
36+ ,osIsWindows
3537 )
3638 where
3739
@@ -241,3 +243,12 @@ maxTerminalWidth = 200
241243-- automatically detect it and when the user doesn't supply one.
242244defaultTerminalWidth :: Int
243245defaultTerminalWidth = 100
246+
247+ -- | True if using Windows OS.
248+ osIsWindows :: Bool
249+ osIsWindows =
250+ #ifdef WINDOWS
251+ True
252+ #else
253+ False
254+ #endif
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import qualified Data.Text as T
1616import Path
1717import Path.IO
1818import qualified Stack.Build
19+ import Stack.Constants (osIsWindows )
1920import Stack.GhcPkg (ghcPkgExeName )
2021import Stack.Options.ScriptParser
2122import Stack.Runners
@@ -122,17 +123,10 @@ scriptCmd opts go' = do
122123 wordsComma = splitWhen (\ c -> c == ' ' || c == ' ,' )
123124
124125 toExeName fp =
125- if isWindows
126+ if osIsWindows
126127 then replaceExtension fp " exe"
127128 else dropExtension fp
128129
129- isWindows :: Bool
130- #ifdef WINDOWS
131- isWindows = True
132- #else
133- isWindows = False
134- #endif
135-
136130getPackagesFromModuleInfo
137131 :: ModuleInfo
138132 -> FilePath -- ^ script filename
You can’t perform that action at this time.
0 commit comments