Pull recent Hadrian changes from upstream
[ghc.git] / rts / PathUtils.h
1 /* ---------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 2001-2016
4 *
5 * Platform-independent path manipulation utilities
6 *
7 * --------------------------------------------------------------------------*/
8
9 #pragma once
10
11 #include "BeginPrivate.h"
12
13 // Use wchar_t for pathnames on Windows (#5697)
14 #if defined(mingw32_HOST_OS)
15 #define pathcmp wcscmp
16 #define pathlen wcslen
17 #define pathopen _wfopen
18 #define pathstat _wstat
19 #define struct_stat struct _stat
20 #define open wopen
21 #define WSTR(s) L##s
22 #define pathprintf swprintf
23 #define pathsize sizeof(wchar_t)
24 #else
25 #define pathcmp strcmp
26 #define pathlen strlen
27 #define pathopen fopen
28 #define pathstat stat
29 #define struct_stat struct stat
30 #define WSTR(s) s
31 #define pathprintf snprintf
32 #define pathsize sizeof(char)
33 #endif
34
35 pathchar* pathdup(pathchar *path);
36 pathchar* pathdir(pathchar *path);
37 pathchar* mkPath(char* path);
38 HsBool endsWithPath(pathchar* base, pathchar* str);
39
40 #include "EndPrivate.h"