From b54040d394830b847a7d64babac23f29fda8d47c Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Thu, 23 Jan 2020 21:56:53 -0500 Subject: [PATCH] stage1: make sure to create native_libc.txt dir - fix regression from #4186 --- src/codegen.cpp | 5 ++++- src/main.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index 3d4d2a8c3..7546025e7 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8996,7 +8996,10 @@ static void detect_libc(CodeGen *g) { "See `zig libc --help` for more details.\n", err_str(err)); exit(1); } - if ((err = os_make_path(g->cache_dir))) { + Buf libc_txt_dir = BUF_INIT; + os_path_dirname(libc_txt, &libc_txt_dir); + buf_deinit(&libc_txt_dir); + if ((err = os_make_path(&libc_txt_dir))) { fprintf(stderr, "Unable to create %s directory: %s\n", buf_ptr(g->cache_dir), err_str(err)); exit(1); diff --git a/src/main.cpp b/src/main.cpp index d89ac352a..fd50c1b14 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -141,15 +141,15 @@ static int print_libc_usage(const char *arg0, FILE *file, int return_code) { "You can save this into a file and then edit the paths to create a cross\n" "compilation libc kit. Then you can pass `--libc [file]` for Zig to use it.\n" "\n" - "When compiling natively and no `--libc` argument provided, Zig automatically\n" - "creates zig-cache/native_libc.txt so that it does not have to detect libc\n" - "on every invocation. You can remove this file to have Zig re-detect the\n" - "native libc.\n" + "When compiling natively and no `--libc` argument provided, Zig will create\n" + "`%s/native_libc.txt`\n" + "so that it does not have to detect libc on every invocation. You can remove\n" + "this file to have Zig re-detect the native libc.\n" "\n\n" "Usage: %s libc [file]\n" "\n" "Parse a libc installation text file and validate it.\n" - , arg0, arg0); + , arg0, buf_ptr(get_global_cache_dir()), arg0); return return_code; }