1 #include "../../../includes/ghcconfig.h"
11 #include "directory.h"
13 #define INLINE /* nothing */
16 * Following code copied from libraries/base/includes/HsBase.h
20 /* A size that will contain many path names, but not necessarily all
21 * (PATH_MAX is not defined on systems with unlimited path length,
24 INLINE HsInt __compat_long_path_size() { return PATH_MAX; }
26 INLINE HsInt __compat_long_path_size() { return 4096; }
29 #if defined(mingw32_HOST_OS)
31 /* Make sure we've got the reqd CSIDL_ constants in scope;
32 * w32api header files are lagging a bit in defining the full set.
34 #if !defined(CSIDL_APPDATA)
35 #define CSIDL_APPDATA 0x001a
37 #if !defined(CSIDL_PERSONAL)
38 #define CSIDL_PERSONAL 0x0005
40 #if !defined(CSIDL_PROFILE)
41 #define CSIDL_PROFILE 0x0028
43 #if !defined(CSIDL_WINDOWS)
44 #define CSIDL_WINDOWS 0x0024
47 INLINE int __hscore_CSIDL_PROFILE() { return CSIDL_PROFILE; }
48 INLINE int __hscore_CSIDL_APPDATA() { return CSIDL_APPDATA; }
49 INLINE int __hscore_CSIDL_WINDOWS() { return CSIDL_WINDOWS; }
50 INLINE int __hscore_CSIDL_PERSONAL() { return CSIDL_PERSONAL; }
53 * Function: __hscore_getFolderPath()
55 * Late-bound version of SHGetFolderPath(), coping with OS versions
56 * that have shell32's lacking that particular API.
59 typedef HRESULT (*HSCORE_GETAPPFOLDERFUNTY)(HWND,int,HANDLE,DWORD,char*);
61 __hscore_getFolderPath(HWND hwndOwner,
67 static int loaded_dll = 0;
68 static HMODULE hMod = (HMODULE)NULL;
69 static HSCORE_GETAPPFOLDERFUNTY funcPtr = NULL;
73 } else if (loaded_dll == 0) {
74 hMod = LoadLibrary("shell32.dll");
79 funcPtr = (HSCORE_GETAPPFOLDERFUNTY)GetProcAddress(hMod, "SHGetFolderPathA");
88 /* OK, if we got this far the function has been bound */
89 return (int)funcPtr(hwndOwner,nFolder,hToken,dwFlags,pszPath);
90 /* ToDo: unload the DLL? */