I know that inside the function addInstallArtifact, .dest_dir.override is defined to be a path relative to the prefix, so the path should not be passed as an absolute path.
But I can't find the option to overwrite the prefix.
Warm regards.
const std = @import("std");
const buffer_size: comptime_int = 128;
var path_buffer: [buffer_size]u8 = undefined;
pub fn build(b: *std.Build) !void {
const path_slice = try checkInstallDir(&path_buffer);
// std.debug.print("{s}\n", .{path_slice});
// `path_slice` would be "/User/<username>/.zig/lib/"
// which is equivalent to "~/.zig/lib/"
// some stuff
const lib = b.addSharedLibrary(.{
.name = "dylib",
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = .ReleaseSafe,
});
const install = b.addInstallArtifact(lib, .{
.dest_dir = .{
// This installs the .dylib file to the specific dir.
.override = .{ .custom = "../../../.zig/lib/" },
// This failed.
// .override = .{ .custom = path_slice },
},
});
b.default_step.dependOn(&install.step);
// setup test steps
return;
}