[commit: packages/Cabal] ghc-head: Mark the '.cabal-sandbox' dir as hidden on Windows. (a1a99c2)
git at git.haskell.org
git at git.haskell.org
Mon Aug 26 23:23:08 CEST 2013
Repository : ssh://git@git.haskell.org/Cabal
On branch : ghc-head
Link : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=a1a99c2b2cac4a88e61c1099dd3cbb3698f64f14
>---------------------------------------------------------------
commit a1a99c2b2cac4a88e61c1099dd3cbb3698f64f14
Author: Mikhail Glushenkov <the.dead.shall.rise at gmail.com>
Date: Mon Apr 29 23:24:09 2013 +0200
Mark the '.cabal-sandbox' dir as hidden on Windows.
>---------------------------------------------------------------
a1a99c2b2cac4a88e61c1099dd3cbb3698f64f14
cabal-install/Distribution/Client/Sandbox.hs | 2 ++
cabal-install/Distribution/Compat/FilePerms.hs | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/cabal-install/Distribution/Client/Sandbox.hs b/cabal-install/Distribution/Client/Sandbox.hs
index 21ba327..52eecd1 100644
--- a/cabal-install/Distribution/Client/Sandbox.hs
+++ b/cabal-install/Distribution/Client/Sandbox.hs
@@ -82,6 +82,7 @@ import Distribution.System ( Platform )
import Distribution.Text ( display )
import Distribution.Verbosity ( Verbosity, lessVerbose )
import Distribution.Compat.Env ( lookupEnv, setEnv )
+import Distribution.Compat.FilePerms ( setFileHidden )
import qualified Distribution.Client.Sandbox.Index as Index
import qualified Distribution.Simple.Register as Register
import Control.Exception ( assert, bracket_ )
@@ -192,6 +193,7 @@ sandboxInit verbosity sandboxFlags globalFlags = do
(sandboxLocation sandboxFlags)
createDirectoryIfMissingVerbose verbosity True sandboxDir'
sandboxDir <- tryCanonicalizePath sandboxDir'
+ setFileHidden sandboxDir
notice verbosity $ "Using a sandbox located at " ++ sandboxDir
-- Determine which compiler to use (using the value from ~/.cabal/config).
diff --git a/cabal-install/Distribution/Compat/FilePerms.hs b/cabal-install/Distribution/Compat/FilePerms.hs
index 284f071..1f8393f 100644
--- a/cabal-install/Distribution/Compat/FilePerms.hs
+++ b/cabal-install/Distribution/Compat/FilePerms.hs
@@ -3,6 +3,7 @@
module Distribution.Compat.FilePerms (
setFileOrdinary,
setFileExecutable,
+ setFileHidden,
) where
#ifndef mingw32_HOST_OS
@@ -14,12 +15,15 @@ import Foreign.C
( withCString )
import Foreign.C
( throwErrnoPathIfMinus1_ )
+#else
+import System.Win32.File (setFileAttributes, fILE_ATTRIBUTE_HIDDEN)
#endif /* mingw32_HOST_OS */
-setFileOrdinary, setFileExecutable :: FilePath -> IO ()
+setFileHidden, setFileOrdinary, setFileExecutable :: FilePath -> IO ()
#ifndef mingw32_HOST_OS
setFileOrdinary path = setFileMode path 0o644 -- file perms -rw-r--r--
setFileExecutable path = setFileMode path 0o755 -- file perms -rwxr-xr-x
+setFileHidden _ = return ()
setFileMode :: FilePath -> FileMode -> IO ()
setFileMode name m =
@@ -28,4 +32,5 @@ setFileMode name m =
#else
setFileOrdinary _ = return ()
setFileExecutable _ = return ()
+setFileHidden path = setFileAttributes path fILE_ATTRIBUTE_HIDDEN
#endif
More information about the ghc-commits
mailing list