98 int sys_unlink(const char *path) { |
98 int sys_unlink(const char *path) { |
99 return unlink(path); |
99 return unlink(path); |
100 } |
100 } |
101 |
101 |
102 int sys_mkdir(const char *path) { |
102 int sys_mkdir(const char *path) { |
|
103 #ifdef _WIN32 |
|
104 return mkdir(path); |
|
105 #else |
103 return mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); |
106 return mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); |
|
107 #endif |
104 } |
108 } |
105 |
109 |
106 #else |
110 #else |
107 /* ---------- Windows implementation ---------- */ |
111 /* ---------- Windows implementation ---------- */ |
108 |
112 |
109 static wchar_t* path2winpath(const char *path, int dir, int *newlen) { |
113 static wchar_t* path2winpath(const char *path, int dir, int *newlen) { |
110 size_t len = strlen(path); |
114 size_t len = strlen(path); |
111 size_t lenadd = dir ? 2 : 0; |
115 size_t lenadd = dir ? 2 : 0; |
112 |
116 |
113 |
117 |
114 wchar_t *wpath = calloc(len+lenadd, sizeof(wchar_t)); |
118 wchar_t *wpath = calloc(len+lenadd+1, sizeof(wchar_t)); |
115 int wlen = MultiByteToWideChar( |
119 int wlen = MultiByteToWideChar( |
116 CP_UTF8, |
120 CP_UTF8, |
117 0, |
121 0, |
118 path, |
122 path, |
119 len, |
123 len, |