| ... | ... | @@ -353,7 +353,7 @@ int main(int argc, char **argv) { |
| 353 | 353 | size_t ver_minor = 0; |
| 354 | 354 | size_t ver_patch = 0; |
| 355 | 355 | bool timing_info = false; |
| 356 | | const char *cache_dir = default_zig_cache_name; |
| 356 | const char *cache_dir = nullptr; |
| 357 | 357 | CliPkg *cur_pkg = allocate<CliPkg>(1); |
| 358 | 358 | BuildMode build_mode = BuildModeDebug; |
| 359 | 359 | ZigList<const char *> test_exec_args = {0}; |
| ... | ... | @@ -403,7 +403,7 @@ int main(int argc, char **argv) { |
| 403 | 403 | |
| 404 | 404 | CodeGen *g = codegen_create(build_runner_path, nullptr, OutTypeExe, BuildModeDebug, zig_lib_dir_buf); |
| 405 | 405 | g->enable_time_report = timing_info; |
| 406 | | buf_init_from_str(&g->cache_dir, cache_dir); |
| 406 | buf_init_from_str(&g->cache_dir, cache_dir ? cache_dir : default_zig_cache_name); |
| 407 | 407 | codegen_set_out_name(g, buf_create_from_str("build")); |
| 408 | 408 | |
| 409 | 409 | Buf *build_file_buf = buf_create_from_str(build_file); |
| ... | ... | @@ -412,8 +412,14 @@ int main(int argc, char **argv) { |
| 412 | 412 | Buf build_file_dirname = BUF_INIT; |
| 413 | 413 | os_path_split(&build_file_abs, &build_file_dirname, &build_file_basename); |
| 414 | 414 | |
| 415 | | Buf *cache_dir_buf = buf_create_from_str(cache_dir); |
| 416 | | Buf full_cache_dir = os_path_resolve(&cache_dir_buf, 1); |
| 415 | |
| 416 | Buf full_cache_dir = BUF_INIT; |
| 417 | if (cache_dir == nullptr) { |
| 418 | os_path_join(&build_file_dirname, buf_create_from_str(default_zig_cache_name), &full_cache_dir); |
| 419 | } else { |
| 420 | Buf *cache_dir_buf = buf_create_from_str(cache_dir); |
| 421 | full_cache_dir = os_path_resolve(&cache_dir_buf, 1); |
| 422 | } |
| 417 | 423 | |
| 418 | 424 | args.items[1] = buf_ptr(&build_file_dirname); |
| 419 | 425 | args.items[2] = buf_ptr(&full_cache_dir); |
| ... | ... | @@ -830,7 +836,7 @@ int main(int argc, char **argv) { |
| 830 | 836 | |
| 831 | 837 | CodeGen *g = codegen_create(zig_root_source_file, target, out_type, build_mode, zig_lib_dir_buf); |
| 832 | 838 | g->enable_time_report = timing_info; |
| 833 | | buf_init_from_str(&g->cache_dir, cache_dir); |
| 839 | buf_init_from_str(&g->cache_dir, cache_dir ? cache_dir : default_zig_cache_name); |
| 834 | 840 | codegen_set_out_name(g, buf_out_name); |
| 835 | 841 | codegen_set_lib_version(g, ver_major, ver_minor, ver_patch); |
| 836 | 842 | codegen_set_is_test(g, cmd == CmdTest); |