| ... | ... | @@ -1037,7 +1037,12 @@ Error os_exec_process(ZigList<const char *> &args, |
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | 1039 | Error os_write_file(Buf *full_path, Buf *contents) { |
| 1040 | #if defined(ZIG_OS_WINDOWS) |
| 1041 | PathSpace path_space = slice_to_prefixed_file_w(buf_to_slice(full_path)); |
| 1042 | FILE *f = _wfopen(&path_space.data.items[0], L"wb"); |
| 1043 | #else |
| 1040 | 1044 | FILE *f = fopen(buf_ptr(full_path), "wb"); |
| 1045 | #endif |
| 1041 | 1046 | if (!f) { |
| 1042 | 1047 | zig_panic("os_write_file failed for %s", buf_ptr(full_path)); |
| 1043 | 1048 | } |
| ... | ... | @@ -1072,7 +1077,12 @@ static Error copy_open_files(FILE *src_f, FILE *dest_f) { |
| 1072 | 1077 | Error os_dump_file(Buf *src_path, FILE *dest_file) { |
| 1073 | 1078 | Error err; |
| 1074 | 1079 | |
| 1080 | #if defined(ZIG_OS_WINDOWS) |
| 1081 | PathSpace path_space = slice_to_prefixed_file_w(buf_to_slice(src_path)); |
| 1082 | FILE *src_f = _wfopen(&path_space.data.items[0], L"rb"); |
| 1083 | #else |
| 1075 | 1084 | FILE *src_f = fopen(buf_ptr(src_path), "rb"); |
| 1085 | #endif |
| 1076 | 1086 | if (!src_f) { |
| 1077 | 1087 | int err = errno; |
| 1078 | 1088 | if (err == ENOENT) { |
| ... | ... | @@ -1189,7 +1199,12 @@ Error os_update_file(Buf *src_path, Buf *dst_path) { |
| 1189 | 1199 | } |
| 1190 | 1200 | |
| 1191 | 1201 | Error os_copy_file(Buf *src_path, Buf *dest_path) { |
| 1202 | #if defined(ZIG_OS_WINDOWS) |
| 1203 | PathSpace src_path_space = slice_to_prefixed_file_w(buf_to_slice(src_path)); |
| 1204 | FILE *src_f = _wfopen(&src_path_space.data.items[0], L"rb"); |
| 1205 | #else |
| 1192 | 1206 | FILE *src_f = fopen(buf_ptr(src_path), "rb"); |
| 1207 | #endif |
| 1193 | 1208 | if (!src_f) { |
| 1194 | 1209 | int err = errno; |
| 1195 | 1210 | if (err == ENOENT) { |
| ... | ... | @@ -1200,7 +1215,12 @@ Error os_copy_file(Buf *src_path, Buf *dest_path) { |
| 1200 | 1215 | return ErrorFileSystem; |
| 1201 | 1216 | } |
| 1202 | 1217 | } |
| 1218 | #if defined(ZIG_OS_WINDOWS) |
| 1219 | PathSpace dest_path_space = slice_to_prefixed_file_w(buf_to_slice(dest_path)); |
| 1220 | FILE *dest_f = _wfopen(&dest_path_space.data.items[0], L"wb"); |
| 1221 | #else |
| 1203 | 1222 | FILE *dest_f = fopen(buf_ptr(dest_path), "wb"); |
| 1223 | #endif |
| 1204 | 1224 | if (!dest_f) { |
| 1205 | 1225 | int err = errno; |
| 1206 | 1226 | if (err == ENOENT) { |
| ... | ... | @@ -1221,7 +1241,12 @@ Error os_copy_file(Buf *src_path, Buf *dest_path) { |
| 1221 | 1241 | } |
| 1222 | 1242 | |
| 1223 | 1243 | Error os_fetch_file_path(Buf *full_path, Buf *out_contents) { |
| 1244 | #if defined(ZIG_OS_WINDOWS) |
| 1245 | PathSpace path_space = slice_to_prefixed_file_w(buf_to_slice(full_path)); |
| 1246 | FILE *f = _wfopen(&path_space.data.items[0], L"rb"); |
| 1247 | #else |
| 1224 | 1248 | FILE *f = fopen(buf_ptr(full_path), "rb"); |
| 1249 | #endif |
| 1225 | 1250 | if (!f) { |
| 1226 | 1251 | switch (errno) { |
| 1227 | 1252 | case EACCES: |