| 35 #include <windows.h> |
35 #include <windows.h> |
| 36 #include <shlwapi.h> |
36 #include <shlwapi.h> |
| 37 |
37 |
| 38 void get_working_dir(const char** out_ptr, size_t *out_len) { |
38 void get_working_dir(const char** out_ptr, size_t *out_len) { |
| 39 static char cwd[MAX_PATH]; |
39 static char cwd[MAX_PATH]; |
| 40 if (GetCurrentDirectory(MAX_PATH, cwd) == 0) { |
40 if (GetCurrentDirectoryA(MAX_PATH, cwd) == 0) { |
| 41 fprintf(stderr, "Could not get current working directory.\n"); |
41 fprintf(stderr, "Could not get current working directory.\n"); |
| 42 exit(1); |
42 exit(1); |
| 43 } |
43 } |
| 44 size_t len = strlen(cwd); |
44 size_t len = strlen(cwd); |
| 45 if (cwd[len - 1] != '/') { |
45 if (cwd[len - 1] != '\\') { |
| 46 cwd[len++] = '/'; |
46 cwd[len++] = '\\'; |
| 47 cwd[len] = '\0'; |
47 cwd[len] = '\0'; |
| 48 } |
48 } |
| 49 *out_ptr = cwd; |
49 *out_ptr = cwd; |
| 50 *out_len = len; |
50 *out_len = len; |
| 51 } |
51 } |
| 52 bool path_is_relative(const char *path) { |
52 bool path_is_relative(const char *path) { |
| 53 return PathIsRelative(path); |
53 return PathIsRelativeA(path); |
| 54 } |
54 } |
| 55 int pathcmp(const char *p1, const char *p2) { |
55 int pathcmp(const char *p1, const char *p2) { |
| 56 return strcasecmp(p1, p2); |
56 return strcasecmp(p1, p2); |
| 57 } |
57 } |
| 58 #else |
58 #else |