Merge pull request #198 from aniljava/master

build config incorrectly pulls folder named zig if it appears in PATH variable before zig executable
This commit is contained in:
Alexandros Naskos 2020-11-24 12:54:40 +02:00 committed by GitHub
commit bdcd2a1e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,12 @@ pub fn config(step: *std.build.Step) anyerror!void {
});
defer allocator.free(full_path);
// Skip folders named zig
const file = std.fs.openFileAbsolute(full_path, .{}) catch continue;
const stat = file.stat() catch continue;
const is_dir = stat.kind == .Directory;
if (is_dir) continue;
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
zig_exe_path = try std.mem.dupe(allocator, u8, std.os.realpath(full_path, &buf) catch continue);
break :find_zig;