| ... | ... | @@ -130,37 +130,35 @@ Error get_compiler_id(Buf **result) { |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | static bool test_zig_install_prefix(Buf *test_path, Buf *out_zig_lib_dir) { |
| 133 | | Buf lib_buf = BUF_INIT; |
| 134 | | buf_init_from_str(&lib_buf, "lib"); |
| 135 | | |
| 136 | | Buf zig_buf = BUF_INIT; |
| 137 | | buf_init_from_str(&zig_buf, "zig"); |
| 138 | | |
| 139 | | Buf std_buf = BUF_INIT; |
| 140 | | buf_init_from_str(&std_buf, "std"); |
| 141 | | |
| 142 | | Buf std_zig_buf = BUF_INIT; |
| 143 | | buf_init_from_str(&std_zig_buf, "std.zig"); |
| 144 | | |
| 145 | | Buf test_lib_dir = BUF_INIT; |
| 146 | | Buf test_zig_dir = BUF_INIT; |
| 147 | | Buf test_std_dir = BUF_INIT; |
| 148 | | Buf test_index_file = BUF_INIT; |
| 149 | | |
| 150 | | os_path_join(test_path, &lib_buf, &test_lib_dir); |
| 151 | | os_path_join(&test_lib_dir, &zig_buf, &test_zig_dir); |
| 152 | | os_path_join(&test_zig_dir, &std_buf, &test_std_dir); |
| 153 | | os_path_join(&test_std_dir, &std_zig_buf, &test_index_file); |
| 154 | | |
| 155 | | int err; |
| 156 | | bool exists; |
| 157 | | if ((err = os_file_exists(&test_index_file, &exists))) { |
| 158 | | exists = false; |
| 133 | { |
| 134 | Buf *test_zig_dir = buf_sprintf("%s" OS_SEP "lib" OS_SEP "zig", buf_ptr(test_path)); |
| 135 | Buf *test_index_file = buf_sprintf("%s" OS_SEP "std" OS_SEP "std.zig", buf_ptr(test_zig_dir)); |
| 136 | int err; |
| 137 | bool exists; |
| 138 | if ((err = os_file_exists(test_index_file, &exists))) { |
| 139 | exists = false; |
| 140 | } |
| 141 | if (exists) { |
| 142 | buf_init_from_buf(out_zig_lib_dir, test_zig_dir); |
| 143 | return true; |
| 144 | } |
| 159 | 145 | } |
| 160 | | if (exists) { |
| 161 | | buf_init_from_buf(out_zig_lib_dir, &test_zig_dir); |
| 162 | | return true; |
| 146 | |
| 147 | // Also try without "zig" |
| 148 | { |
| 149 | Buf *test_zig_dir = buf_sprintf("%s" OS_SEP "lib", buf_ptr(test_path)); |
| 150 | Buf *test_index_file = buf_sprintf("%s" OS_SEP "std" OS_SEP "std.zig", buf_ptr(test_zig_dir)); |
| 151 | int err; |
| 152 | bool exists; |
| 153 | if ((err = os_file_exists(test_index_file, &exists))) { |
| 154 | exists = false; |
| 155 | } |
| 156 | if (exists) { |
| 157 | buf_init_from_buf(out_zig_lib_dir, test_zig_dir); |
| 158 | return true; |
| 159 | } |
| 163 | 160 | } |
| 161 | |
| 164 | 162 | return false; |
| 165 | 163 | } |
| 166 | 164 | |