1 /* -----------------------------------------------------------------------------
3 * (c) The University of Glasgow 2001-2004
5 * Definitions for package `directory' which are visible in Haskell land.
7 * ---------------------------------------------------------------------------*/
9 #ifndef __HSDIRECTORY_H__
10 #define __HSDIRECTORY_H__
12 #include "HsDirectoryConfig.h"
15 #include <sys/types.h>
26 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
27 extern int __hscore_getFolderPath(HWND hwndOwner,
34 /* -----------------------------------------------------------------------------
37 These functions are given as inlines here for when compiling via C,
38 but we also generate static versions into the cbits library for
39 when compiling to native code.
40 -------------------------------------------------------------------------- */
43 # if defined(_MSC_VER)
44 # define INLINE extern __inline
46 # define INLINE static inline
50 /* A size that will contain many path names, but not necessarily all
51 * (PATH_MAX is not defined on systems with unlimited path length,
54 INLINE HsInt __hscore_long_path_size() {
62 #ifdef __GLASGOW_HASKELL__
63 INLINE int __hscore_R_OK() { return R_OK; }
64 INLINE int __hscore_W_OK() { return W_OK; }
65 INLINE int __hscore_X_OK() { return X_OK; }
67 INLINE mode_t __hscore_S_IRUSR() { return S_IRUSR; }
68 INLINE mode_t __hscore_S_IWUSR() { return S_IWUSR; }
69 INLINE mode_t __hscore_S_IXUSR() { return S_IXUSR; }
72 #if defined(__MINGW32__)
74 /* Make sure we've got the reqd CSIDL_ constants in scope;
75 * w32api header files are lagging a bit in defining the full set.
77 #if !defined(CSIDL_APPDATA)
78 #define CSIDL_APPDATA 0x001a
80 #if !defined(CSIDL_PERSONAL)
81 #define CSIDL_PERSONAL 0x0005
83 #if !defined(CSIDL_PROFILE)
84 #define CSIDL_PROFILE 0x0028
86 #if !defined(CSIDL_WINDOWS)
87 #define CSIDL_WINDOWS 0x0024
90 INLINE int __hscore_CSIDL_PROFILE() { return CSIDL_PROFILE; }
91 INLINE int __hscore_CSIDL_APPDATA() { return CSIDL_APPDATA; }
92 INLINE int __hscore_CSIDL_WINDOWS() { return CSIDL_WINDOWS; }
93 INLINE int __hscore_CSIDL_PERSONAL() { return CSIDL_PERSONAL; }
96 #endif /* __HSDIRECTORY_H__ */