diff options
| author | Michael Dusan <michael.dusan@gmail.com> | 2019-11-02 17:01:43 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-02 18:30:07 -0400 |
| commit | 10046f9a52c089c656bfd4578e4ef17671ff1f75 (patch) | |
| tree | 4b63ae0994061631a051a18895da03aa28a80ae7 /src/compiler.cpp | |
| parent | 2e0dd5733f9aec168f72167ca0a0e306b2810ae2 (diff) | |
| download | zig-10046f9a52c089c656bfd4578e4ef17671ff1f75.tar.gz zig-10046f9a52c089c656bfd4578e4ef17671ff1f75.zip | |
stage1: add linux XDG Base Directory support
- define zig global cache based on XDG spec:
if env XDG_CACHE_HOME {
"$XDG_CACHE_HOME/zig"
} else {
"$HOME/.cache/zig"
}
- old definition "$HOME/.local/share/zig" is retired
- closes #3573
Diffstat (limited to 'src/compiler.cpp')
| -rw-r--r-- | src/compiler.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler.cpp b/src/compiler.cpp index 50be7416b2..25bf124287 100644 --- a/src/compiler.cpp +++ b/src/compiler.cpp @@ -4,7 +4,7 @@ #include <stdio.h> static Buf saved_compiler_id = BUF_INIT; -static Buf saved_app_data_dir = BUF_INIT; +static Buf saved_cache_dir = BUF_INIT; static Buf saved_stage1_path = BUF_INIT; static Buf saved_lib_dir = BUF_INIT; static Buf saved_special_dir = BUF_INIT; @@ -21,11 +21,11 @@ Buf *get_stage1_cache_path(void) { return &saved_stage1_path; } Error err; - if ((err = os_get_app_data_dir(&saved_app_data_dir, "zig"))) { - fprintf(stderr, "Unable to get app data dir: %s\n", err_str(err)); + if ((err = os_get_cache_dir(&saved_cache_dir, "zig"))) { + fprintf(stderr, "Unable to get cache dir: %s\n", err_str(err)); exit(1); } - os_path_join(&saved_app_data_dir, buf_create_from_str("stage1"), &saved_stage1_path); + os_path_join(&saved_cache_dir, buf_create_from_str("stage1"), &saved_stage1_path); return &saved_stage1_path; } |
