diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2018-11-26 20:04:35 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2018-11-26 20:04:35 -0500 |
| commit | 67a39a4c99106714588676db0168fef52e0ecd9c (patch) | |
| tree | fe52321c10fce3a432acc2236607ffb640f74651 /src/codegen.cpp | |
| parent | d2ed4d3dd39505397b1edf7fdfc79f6aa200d495 (diff) | |
| download | zig-67a39a4c99106714588676db0168fef52e0ecd9c.tar.gz zig-67a39a4c99106714588676db0168fef52e0ecd9c.zip | |
stage1: better file path handling
* better message printed when cache hash fails
* better handling of '/' as root source file
* os_path_split parses '/' and '/a' correctly
closes #1693
closes #1746
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 37e0424961..1033ed8120 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -129,6 +129,11 @@ CodeGen *codegen_create(Buf *root_src_path, const ZigTarget *target, OutType out Buf *src_dir = buf_alloc(); os_path_split(root_src_path, src_dir, src_basename); + if (buf_len(src_basename) == 0) { + fprintf(stderr, "Invalid root source path: %s\n", buf_ptr(root_src_path)); + exit(1); + } + g->root_package = new_package(buf_ptr(src_dir), buf_ptr(src_basename)); g->std_package = new_package(buf_ptr(g->zig_std_dir), "index.zig"); g->root_package->package_table.put(buf_create_from_str("std"), g->std_package); @@ -8178,7 +8183,11 @@ void codegen_build_and_link(CodeGen *g) { os_path_join(stage1_dir, buf_create_from_str("build"), manifest_dir); if ((err = check_cache(g, manifest_dir, &digest))) { - fprintf(stderr, "Unable to check cache: %s\n", err_str(err)); + if (err == ErrorCacheUnavailable) { + // message already printed + } else { + fprintf(stderr, "Unable to check cache: %s\n", err_str(err)); + } exit(1); } |
