[commit: packages/directory] master: Check Win32 version before using cSIDL_LOCAL_APPDATA (b3d109e)

git at git.haskell.org git at git.haskell.org
Fri Dec 18 09:50:45 UTC 2015


Repository : ssh://git@git.haskell.org/directory

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b3d109e853b9854468e8e6129682326355a64c78/directory

>---------------------------------------------------------------

commit b3d109e853b9854468e8e6129682326355a64c78
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Mon May 25 02:51:00 2015 -0400

    Check Win32 version before using cSIDL_LOCAL_APPDATA


>---------------------------------------------------------------

b3d109e853b9854468e8e6129682326355a64c78
 System/Directory.hs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/System/Directory.hs b/System/Directory.hs
index e871797..6c4014b 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -137,6 +137,15 @@ import qualified System.Posix as Posix
 
 #endif /* __GLASGOW_HASKELL__ */
 
+#ifdef mingw32_HOST_OS
+win32_cSIDL_LOCAL_APPDATA :: Win32.CSIDL
+#if MIN_VERSION_Win32(2, 3, 1)
+win32_cSIDL_LOCAL_APPDATA = Win32.cSIDL_LOCAL_APPDATA -- only on HEAD atm
+#else
+win32_cSIDL_LOCAL_APPDATA = 0x001c
+#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
@@ -1247,7 +1256,7 @@ getXdgDirectory xdgDir suffix =
   where
 #if defined(mingw32_HOST_OS)
     get isLocal _ _ = Win32.sHGetFolderPath nullPtr which nullPtr 0
-      where which | isLocal   = Win32.cSIDL_LOCAL_APPDATA
+      where which | isLocal   = win32_cSIDL_LOCAL_APPDATA
                   | otherwise = Win32.cSIDL_APPDATA
 #else
     get _ name fallback = do



More information about the ghc-commits mailing list