[commit: packages/directory] Mistuke-bump-win32-version-bounds, bgamari-patch-1, cbits, master: Move Windows-specific foreign entities to Internal modules (d05d7fd)
git at git.haskell.org
git at git.haskell.org
Mon Apr 17 21:33:51 UTC 2017
Repository : ssh://git@git.haskell.org/directory
On branches: Mistuke-bump-win32-version-bounds,bgamari-patch-1,cbits,master
Link : http://ghc.haskell.org/trac/ghc/changeset/d05d7fdb27cc5c1e54e0ebb5e5a96335efc785a8/directory
>---------------------------------------------------------------
commit d05d7fdb27cc5c1e54e0ebb5e5a96335efc785a8
Author: Phil Ruffwind <rf at rufflewind.com>
Date: Wed Apr 27 01:24:49 2016 -0400
Move Windows-specific foreign entities to Internal modules
>---------------------------------------------------------------
d05d7fdb27cc5c1e54e0ebb5e5a96335efc785a8
System/Directory.hs | 20 +-------------------
System/Directory/Internal/C_utimensat.hsc | 6 ++----
System/Directory/Internal/Posix.hsc | 6 ++----
System/Directory/Internal/Windows.hsc | 30 ++++++++++++++++++++++++++----
4 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/System/Directory.hs b/System/Directory.hs
index 4e41e14..bec9149 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -161,18 +161,6 @@ import System.Posix.Internals ( withFilePath )
import System.Directory.Internal
-#ifdef mingw32_HOST_OS
-win32_cSIDL_LOCAL_APPDATA :: Win32.CSIDL
-win32_fILE_SHARE_DELETE :: Win32.ShareMode
-#if MIN_VERSION_Win32(2, 3, 1)
-win32_cSIDL_LOCAL_APPDATA = Win32.cSIDL_LOCAL_APPDATA -- only on HEAD atm
-win32_fILE_SHARE_DELETE = Win32.fILE_SHARE_DELETE -- added in 2.3.0.2
-#else
-win32_cSIDL_LOCAL_APPDATA = 0x001c
-win32_fILE_SHARE_DELETE = 0x00000004
-#endif
-#endif
-
{- $intro
A directory contains a series of entries, each of which is a named
reference to a file system object (file, directory etc.). Some
@@ -336,11 +324,6 @@ setPermissions name (Permissions r w e s) =
modifyBit True m b = m .|. b
#endif
-#ifdef mingw32_HOST_OS
-foreign import ccall unsafe "_wchmod"
- c_wchmod :: CWString -> CMode -> IO CInt
-#endif
-
copyPermissions :: FilePath -> FilePath -> IO ()
copyPermissions source dest =
#ifdef mingw32_HOST_OS
@@ -1375,8 +1358,7 @@ isSymbolicLink path =
#ifdef mingw32_HOST_OS
isReparsePoint <$> Win32.getFileAttributes path
where
- fILE_ATTRIBUTE_REPARSE_POINT = 0x400
- isReparsePoint attr = attr .&. fILE_ATTRIBUTE_REPARSE_POINT /= 0
+ isReparsePoint attr = attr .&. win32_fILE_ATTRIBUTE_REPARSE_POINT /= 0
#else
Posix.isSymbolicLink <$> Posix.getSymbolicLinkStatus path
#endif
diff --git a/System/Directory/Internal/C_utimensat.hsc b/System/Directory/Internal/C_utimensat.hsc
index cc3295b..7182393 100644
--- a/System/Directory/Internal/C_utimensat.hsc
+++ b/System/Directory/Internal/C_utimensat.hsc
@@ -1,5 +1,6 @@
+module System.Directory.Internal.C_utimensat where
#include <HsDirectoryConfig.h>
-
+#ifdef HAVE_UTIMENSAT
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
@@ -9,9 +10,6 @@
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
-
-module System.Directory.Internal.C_utimensat where
-#ifdef HAVE_UTIMENSAT
import Foreign
import Foreign.C
import Data.Time.Clock.POSIX (POSIXTime)
diff --git a/System/Directory/Internal/Posix.hsc b/System/Directory/Internal/Posix.hsc
index 8dfd6fb..1cea4b0 100644
--- a/System/Directory/Internal/Posix.hsc
+++ b/System/Directory/Internal/Posix.hsc
@@ -1,11 +1,9 @@
+module System.Directory.Internal.Posix where
#include <HsDirectoryConfig.h>
-
+#ifndef mingw32_HOST_OS
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
-
-module System.Directory.Internal.Posix where
-#ifndef mingw32_HOST_OS
import Control.Monad ((>=>))
import Control.Exception (bracket)
import Foreign
diff --git a/System/Directory/Internal/Windows.hsc b/System/Directory/Internal/Windows.hsc
index 5eb36fc..25521fe 100644
--- a/System/Directory/Internal/Windows.hsc
+++ b/System/Directory/Internal/Windows.hsc
@@ -1,12 +1,34 @@
+module System.Directory.Internal.Windows where
#include <HsDirectoryConfig.h>
-
+#ifdef mingw32_HOST_OS
+#include <shlobj.h>
+#include <windows.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
-
-module System.Directory.Internal.Windows where
-#ifdef mingw32_HOST_OS
+import Foreign.C
import System.Posix.Types
+import qualified System.Win32 as Win32
+
+win32_cSIDL_LOCAL_APPDATA :: Win32.CSIDL
+#if MIN_VERSION_Win32(2, 3, 1)
+win32_cSIDL_LOCAL_APPDATA = Win32.cSIDL_LOCAL_APPDATA
+#else
+win32_cSIDL_LOCAL_APPDATA = (#const CSIDL_LOCAL_APPDATA)
+#endif
+
+win32_fILE_ATTRIBUTE_REPARSE_POINT :: Win32.FileAttributeOrFlag
+win32_fILE_ATTRIBUTE_REPARSE_POINT = (#const FILE_ATTRIBUTE_REPARSE_POINT)
+
+win32_fILE_SHARE_DELETE :: Win32.ShareMode
+#if MIN_VERSION_Win32(2, 3, 1)
+win32_fILE_SHARE_DELETE = Win32.fILE_SHARE_DELETE -- added in 2.3.0.2
+#else
+win32_fILE_SHARE_DELETE = (#const FILE_SHARE_DELETE)
+#endif
+
+foreign import ccall unsafe "_wchmod"
+ c_wchmod :: CWString -> CMode -> IO CInt
s_IRUSR :: CMode
s_IRUSR = (#const S_IRUSR)
More information about the ghc-commits
mailing list