aboutsummaryrefslogtreecommitdiff
path: root/lib/std/build.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-12-01 09:56:01 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-12-01 09:56:01 -0500
commitb36c07a95a6cf9b2cc120133b44cbd0673e6823a (patch)
tree2c2bf8ff9137d51b80ae56dc70ef9375b8c13583 /lib/std/build.zig
parentb220be7a33a9835a1ec7a033e472830290332d57 (diff)
parent4b6740e19d57454f3c4eac0c2e9a92ce08e7ec04 (diff)
downloadzig-b36c07a95a6cf9b2cc120133b44cbd0673e6823a.tar.gz
zig-b36c07a95a6cf9b2cc120133b44cbd0673e6823a.zip
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion
Diffstat (limited to 'lib/std/build.zig')
-rw-r--r--lib/std/build.zig32
1 files changed, 23 insertions, 9 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig
index fe980aaf89..bfde2f52d7 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -2062,14 +2062,28 @@ pub const RunStep = struct {
}
pub fn addPathDir(self: *RunStep, search_path: []const u8) void {
- const PATH = if (builtin.os == .windows) "Path" else "PATH";
const env_map = self.getEnvMap();
- const prev_path = env_map.get(PATH) orelse {
- env_map.set(PATH, search_path) catch unreachable;
- return;
- };
- const new_path = self.builder.fmt("{}" ++ &[1]u8{fs.path.delimiter} ++ "{}", prev_path, search_path);
- env_map.set(PATH, new_path) catch unreachable;
+
+ var key: []const u8 = undefined;
+ var prev_path: ?[]const u8 = undefined;
+ if (builtin.os == .windows) {
+ key = "Path";
+ prev_path = env_map.get(key);
+ if (prev_path == null) {
+ key = "PATH";
+ prev_path = env_map.get(key);
+ }
+ } else {
+ key = "PATH";
+ prev_path = env_map.get(key);
+ }
+
+ if (prev_path) |pp| {
+ const new_path = self.builder.fmt("{}" ++ [1]u8{fs.path.delimiter} ++ "{}", pp, search_path);
+ env_map.set(key, new_path) catch unreachable;
+ } else {
+ env_map.set(key, search_path) catch unreachable;
+ }
}
pub fn getEnvMap(self: *RunStep) *BufMap {
@@ -2178,7 +2192,7 @@ const InstallArtifactStep = struct {
const full_dest_path = builder.getInstallPath(self.dest_dir, self.artifact.out_filename);
try builder.updateFile(self.artifact.getOutputPath(), full_dest_path);
- if (self.artifact.isDynamicLibrary()) {
+ if (self.artifact.isDynamicLibrary() and self.artifact.target.wantSharedLibSymLinks()) {
try doAtomicSymLinks(builder.allocator, full_dest_path, self.artifact.major_only_filename, self.artifact.name_only_filename);
}
if (self.pdb_dir) |pdb_dir| {
@@ -2405,7 +2419,7 @@ fn findVcpkgRoot(allocator: *Allocator) !?[]const u8 {
const path_file = try fs.path.join(allocator, &[_][]const u8{ appdata_path, "vcpkg.path.txt" });
defer allocator.free(path_file);
- const file = fs.File.openRead(path_file) catch return null;
+ const file = fs.cwd().openFile(path_file, .{}) catch return null;
defer file.close();
const size = @intCast(usize, try file.getEndPos());