summaryrefslogtreecommitdiff
path: root/rts/PathUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'rts/PathUtils.h')
-rw-r--r--rts/PathUtils.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/rts/PathUtils.h b/rts/PathUtils.h
new file mode 100644
index 0000000000..4821938d7d
--- /dev/null
+++ b/rts/PathUtils.h
@@ -0,0 +1,43 @@
+/* ---------------------------------------------------------------------------
+ *
+ * (c) The GHC Team, 2001-2016
+ *
+ * Platform-independent path manipulation utilities
+ *
+ * --------------------------------------------------------------------------*/
+
+#ifndef PATH_UTILS_H
+#define PATH_UTILS_H
+
+#include "BeginPrivate.h"
+
+// Use wchar_t for pathnames on Windows (#5697)
+#if defined(mingw32_HOST_OS)
+#define pathcmp wcscmp
+#define pathlen wcslen
+#define pathopen _wfopen
+#define pathstat _wstat
+#define struct_stat struct _stat
+#define open wopen
+#define WSTR(s) L##s
+#define pathprintf swprintf
+#define pathsize sizeof(wchar_t)
+#else
+#define pathcmp strcmp
+#define pathlen strlen
+#define pathopen fopen
+#define pathstat stat
+#define struct_stat struct stat
+#define WSTR(s) s
+#define pathprintf snprintf
+#define pathsize sizeof(char)
+#endif
+
+pathchar* pathdup(pathchar *path);
+pathchar* pathdir(pathchar *path);
+pathchar* mkPath(char* path);
+HsBool endsWithPath(pathchar* base, pathchar* str);
+
+#include "EndPrivate.h"
+
+#endif /* PATH_UTILS_H */