diff --git a/build/0.11.zig b/build/0.11.zig index 2c45fc86..7131097d 100644 --- a/build/0.11.zig +++ b/build/0.11.zig @@ -33,17 +33,17 @@ pub fn build(b: *Build) void { while (iterate.next()) |val| { if (val) |entry| { // get the entry name, entry can be file or directory - const name = entry.name; + const output_name = std.mem.trimRight(u8, entry.name, ".zig"); if (entry.kind == .file) { // connect path - const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, name }) catch |err| { + const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, entry.name }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.os.exit(1); }; // build exe const exe = b.addExecutable(.{ - .name = name, + .name = output_name, .root_source_file = .{ .path = path }, .target = target, .optimize = optimize, @@ -68,7 +68,7 @@ pub fn build(b: *Build) void { var child = ChildProcess.init(&args, b.allocator); // build cwd - const cwd = std.fs.path.join(b.allocator, &[_][]const u8{ full_path, name }) catch |err| { + const cwd = std.fs.path.join(b.allocator, &[_][]const u8{ full_path, entry.name }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.os.exit(1); }; diff --git a/build/0.12.zig b/build/0.12.zig index a88f0318..c6b4c115 100644 --- a/build/0.12.zig +++ b/build/0.12.zig @@ -32,18 +32,18 @@ pub fn build(b: *Build) void { while (iterate.next()) |val| { if (val) |entry| { // get the entry name, entry can be file or directory - const name = entry.name; + const output_name = std.mem.trimRight(u8, entry.name, ".zig"); if (entry.kind == .file) { // connect path - const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, name }) catch |err| { + const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, entry.name }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.process.exit(1); }; // build exe const exe = b.addExecutable(.{ - .name = name, + .name = output_name, .root_source_file = b.path(path), .target = target, .optimize = optimize, @@ -70,7 +70,7 @@ pub fn build(b: *Build) void { // build cwd const cwd = std.fs.path.join(b.allocator, &[_][]const u8{ full_path, - name, + entry.name, }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.process.exit(1); diff --git a/build/0.13.zig b/build/0.13.zig index 9a1a3292..d74d7e81 100644 --- a/build/0.13.zig +++ b/build/0.13.zig @@ -32,18 +32,18 @@ pub fn build(b: *Build) void { while (iterate.next()) |val| { if (val) |entry| { // get the entry name, entry can be file or directory - const name = entry.name; + const output_name = std.mem.trimRight(u8, entry.name, ".zig"); if (entry.kind == .file) { // connect path - const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, name }) catch |err| { + const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, entry.name }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.process.exit(1); }; // build exe const exe = b.addExecutable(.{ - .name = name, + .name = output_name, .root_source_file = b.path(path), .target = target, .optimize = optimize, @@ -68,10 +68,7 @@ pub fn build(b: *Build) void { var child = ChildProcess.init(&args, b.allocator); // build cwd - const cwd = std.fs.path.join(b.allocator, &[_][]const u8{ - full_path, - name, - }) catch |err| { + const cwd = std.fs.path.join(b.allocator, &[_][]const u8{ full_path, entry.name }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.process.exit(1); }; diff --git a/build/0.14.zig b/build/0.14.zig index 623f42b1..8e55bf69 100644 --- a/build/0.14.zig +++ b/build/0.14.zig @@ -32,18 +32,18 @@ pub fn build(b: *Build) void { while (iterate.next()) |val| { if (val) |entry| { // get the entry name, entry can be file or directory - const name = entry.name; + const output_name = std.mem.trimRight(u8, entry.name, ".zig"); if (entry.kind == .file) { // connect path - const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, name }) catch |err| { + const path = std.fs.path.join(b.allocator, &[_][]const u8{ relative_path, entry.name }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.process.exit(1); }; // build exe const exe = b.addExecutable(.{ - .name = name, + .name = output_name, .root_source_file = b.path(path), .target = target, .optimize = optimize, @@ -70,7 +70,7 @@ pub fn build(b: *Build) void { // build cwd const cwd = std.fs.path.join(b.allocator, &[_][]const u8{ full_path, - name, + entry.name, }) catch |err| { log.err("fmt path for examples failed, err is {}", .{err}); std.process.exit(1);