Merge pull request #1599 from ziglang/zig-build-arg0

zig build: use os_self_exe_path to determine exe path not arg0
master
Andrew Kelley 2018-09-28 18:45:50 -04:00 committed by GitHub
commit 40da2c6098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -394,7 +394,12 @@ int main(int argc, char **argv) {
bool no_rosegment_workaround = false;
if (argc >= 2 && strcmp(argv[1], "build") == 0) {
const char *zig_exe_path = arg0;
Buf zig_exe_path_buf = BUF_INIT;
if ((err = os_self_exe_path(&zig_exe_path_buf))) {
fprintf(stderr, "Unable to determine path to zig's own executable\n");
return EXIT_FAILURE;
}
const char *zig_exe_path = buf_ptr(&zig_exe_path_buf);
const char *build_file = "build.zig";
bool asked_for_help = false;