From 1e60ca4b752a61e26067b4893be623442836ec6f Mon Sep 17 00:00:00 2001 From: kristopher tate Date: Fri, 30 Nov 2018 01:51:31 +0900 Subject: [PATCH] stage2: update std.os.path.join method signature; stage2: take 2; --- src-self-hosted/compilation.zig | 6 +++--- src-self-hosted/introspect.zig | 4 ++-- src-self-hosted/libc_installation.zig | 8 ++++---- src-self-hosted/link.zig | 2 +- src-self-hosted/main.zig | 2 +- src-self-hosted/test.zig | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src-self-hosted/compilation.zig b/src-self-hosted/compilation.zig index a8c3e13e33..c3eae1f803 100644 --- a/src-self-hosted/compilation.zig +++ b/src-self-hosted/compilation.zig @@ -485,7 +485,7 @@ pub const Compilation = struct { comp.name = try Buffer.init(comp.arena(), name); comp.llvm_triple = try target.getTriple(comp.arena()); comp.llvm_target = try Target.llvmTargetFromTriple(comp.llvm_triple); - comp.zig_std_dir = try std.os.path.join(comp.arena(), zig_lib_dir, "std"); + comp.zig_std_dir = try std.os.path.join(comp.arena(), [][]const u8{ zig_lib_dir, "std" }); const opt_level = switch (build_mode) { builtin.Mode.Debug => llvm.CodeGenLevelNone, @@ -1183,7 +1183,7 @@ pub const Compilation = struct { const file_name = try std.fmt.allocPrint(self.gpa(), "{}{}", file_prefix[0..], suffix); defer self.gpa().free(file_name); - const full_path = try os.path.join(self.gpa(), tmp_dir, file_name[0..]); + const full_path = try os.path.join(self.gpa(), [][]const u8{ tmp_dir, file_name[0..] }); errdefer self.gpa().free(full_path); return Buffer.fromOwnedSlice(self.gpa(), full_path); @@ -1204,7 +1204,7 @@ pub const Compilation = struct { const zig_dir_path = try getZigDir(self.gpa()); defer self.gpa().free(zig_dir_path); - const tmp_dir = try os.path.join(self.arena(), zig_dir_path, comp_dir_name[0..]); + const tmp_dir = try os.path.join(self.arena(), [][]const u8{ zig_dir_path, comp_dir_name[0..] }); try os.makePath(self.gpa(), tmp_dir); return tmp_dir; } diff --git a/src-self-hosted/introspect.zig b/src-self-hosted/introspect.zig index d41f82f755..0a7f63b4f1 100644 --- a/src-self-hosted/introspect.zig +++ b/src-self-hosted/introspect.zig @@ -8,10 +8,10 @@ const warn = std.debug.warn; /// Caller must free result pub fn testZigInstallPrefix(allocator: *mem.Allocator, test_path: []const u8) ![]u8 { - const test_zig_dir = try os.path.join(allocator, test_path, "lib", "zig"); + const test_zig_dir = try os.path.join(allocator, [][]const u8{ test_path, "lib", "zig" }); errdefer allocator.free(test_zig_dir); - const test_index_file = try os.path.join(allocator, test_zig_dir, "std", "index.zig"); + const test_index_file = try os.path.join(allocator, [][]const u8{ test_zig_dir, "std", "index.zig" }); defer allocator.free(test_index_file); var file = try os.File.openRead(test_index_file); diff --git a/src-self-hosted/libc_installation.zig b/src-self-hosted/libc_installation.zig index 1c5d111c5a..6e8c997c08 100644 --- a/src-self-hosted/libc_installation.zig +++ b/src-self-hosted/libc_installation.zig @@ -230,7 +230,7 @@ pub const LibCInstallation = struct { while (path_i < search_paths.len) : (path_i += 1) { const search_path_untrimmed = search_paths.at(search_paths.len - path_i - 1); const search_path = std.mem.trimLeft(u8, search_path_untrimmed, " "); - const stdlib_path = try std.os.path.join(loop.allocator, search_path, "stdlib.h"); + const stdlib_path = try std.os.path.join(loop.allocator, [][]const u8{ search_path, "stdlib.h" }); defer loop.allocator.free(stdlib_path); if (try fileExists(stdlib_path)) { @@ -254,7 +254,7 @@ pub const LibCInstallation = struct { const stream = &std.io.BufferOutStream.init(&result_buf).stream; try stream.print("{}\\Include\\{}\\ucrt", search.path, search.version); - const stdlib_path = try std.os.path.join(loop.allocator, result_buf.toSliceConst(), "stdlib.h"); + const stdlib_path = try std.os.path.join(loop.allocator, [][]const u8{ result_buf.toSliceConst(), "stdlib.h" }); defer loop.allocator.free(stdlib_path); if (try fileExists(stdlib_path)) { @@ -283,7 +283,7 @@ pub const LibCInstallation = struct { builtin.Arch.aarch64v8 => try stream.write("arm"), else => return error.UnsupportedArchitecture, } - const ucrt_lib_path = try std.os.path.join(loop.allocator, result_buf.toSliceConst(), "ucrt.lib"); + const ucrt_lib_path = try std.os.path.join(loop.allocator, [][]const u8{ result_buf.toSliceConst(), "ucrt.lib" }); defer loop.allocator.free(ucrt_lib_path); if (try fileExists(ucrt_lib_path)) { self.lib_dir = result_buf.toOwnedSlice(); @@ -358,7 +358,7 @@ pub const LibCInstallation = struct { builtin.Arch.aarch64v8 => try stream.write("arm\\"), else => return error.UnsupportedArchitecture, } - const kernel32_path = try std.os.path.join(loop.allocator, result_buf.toSliceConst(), "kernel32.lib"); + const kernel32_path = try std.os.path.join(loop.allocator, [][]const u8{ result_buf.toSliceConst(), "kernel32.lib" }); defer loop.allocator.free(kernel32_path); if (try fileExists(kernel32_path)) { self.kernel32_lib_dir = result_buf.toOwnedSlice(); diff --git a/src-self-hosted/link.zig b/src-self-hosted/link.zig index 1b32533ebc..fadc9b0189 100644 --- a/src-self-hosted/link.zig +++ b/src-self-hosted/link.zig @@ -315,7 +315,7 @@ fn constructLinkerArgsElf(ctx: *Context) !void { } fn addPathJoin(ctx: *Context, dirname: []const u8, basename: []const u8) !void { - const full_path = try std.os.path.join(&ctx.arena.allocator, dirname, basename); + const full_path = try std.os.path.join(&ctx.arena.allocator, [][]const u8{ dirname, basename }); const full_path_with_null = try std.cstr.addNullByte(&ctx.arena.allocator, full_path); try ctx.args.append(full_path_with_null.ptr); } diff --git a/src-self-hosted/main.zig b/src-self-hosted/main.zig index 0742cbfe65..36aab4141b 100644 --- a/src-self-hosted/main.zig +++ b/src-self-hosted/main.zig @@ -757,7 +757,7 @@ async fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) FmtErro var group = event.Group(FmtError!void).init(fmt.loop); while (try dir.next()) |entry| { if (entry.kind == std.os.Dir.Entry.Kind.Directory or mem.endsWith(u8, entry.name, ".zig")) { - const full_path = try os.path.join(fmt.loop.allocator, file_path, entry.name); + const full_path = try os.path.join(fmt.loop.allocator, [][]const u8{ file_path, entry.name }); try group.call(fmtPath, fmt, full_path, check_mode); } } diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig index ff5b96df84..de551cf7f7 100644 --- a/src-self-hosted/test.zig +++ b/src-self-hosted/test.zig @@ -87,7 +87,7 @@ pub const TestContext = struct { ) !void { var file_index_buf: [20]u8 = undefined; const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", self.file_index.incr()); - const file1_path = try std.os.path.join(allocator, tmp_dir_name, file_index, file1); + const file1_path = try std.os.path.join(allocator, [][]const u8{ tmp_dir_name, file_index, file1 }); if (std.os.path.dirname(file1_path)) |dirname| { try std.os.makePath(allocator, dirname); @@ -120,7 +120,7 @@ pub const TestContext = struct { ) !void { var file_index_buf: [20]u8 = undefined; const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", self.file_index.incr()); - const file1_path = try std.os.path.join(allocator, tmp_dir_name, file_index, file1); + const file1_path = try std.os.path.join(allocator, [][]const u8{ tmp_dir_name, file_index, file1 }); const output_file = try std.fmt.allocPrint(allocator, "{}-out{}", file1_path, Target(Target.Native).exeFileExt()); if (std.os.path.dirname(file1_path)) |dirname| {