From ed5fdbd4cbbc77564e55865fdc54f84d21d9d465 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Wed, 26 Apr 2023 12:44:32 -0700 Subject: [PATCH] fix cachepath to be right when Deps define their own Deps --- src/common.zig | 2 +- src/util/module.zig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common.zig b/src/common.zig index 2bc0210f0ca8f86046636e143e44a39aa9c90ee2..d862c7fe02ab2c4a0809bb636f5b5a0f0fd26f11 100644 --- a/src/common.zig +++ b/src/common.zig @@ -243,7 +243,7 @@ pub fn get_module_from_dep(d: *zigmod.Dep, cachepath: string, options: *CollectO var dd = collect_deps(cachepath, moddir, d.type, options) catch |e| switch (e) { error.ManifestNotFound => { if (d.main.len > 0 or d.c_include_dirs.len > 0 or d.c_source_files.len > 0 or d.keep) { - var mod_from = try zigmod.Module.from(options.alloc, d.*, modpath, options); + var mod_from = try zigmod.Module.from(options.alloc, d.*, cachepath, options); if (d.type != .local) mod_from.clean_path = extras.trimPrefix(modpath, cachepath)[1..]; if (mod_from.is_for_this()) return mod_from; return null; diff --git a/src/util/module.zig b/src/util/module.zig index fd6c04316f7efee6f337c506238877584c5fb2fa..bc52843c0ee4adc294f92bb436662ff01cc1ae4a 100644 --- a/src/util/module.zig +++ b/src/util/module.zig @@ -29,12 +29,12 @@ pub const Module = struct { min_zig_version: ?std.SemanticVersion, vcpkg: bool, - pub fn from(alloc: std.mem.Allocator, dep: zigmod.Dep, modpath: string, options: *common.CollectOptions) !Module { + pub fn from(alloc: std.mem.Allocator, dep: zigmod.Dep, cachepath: string, options: *common.CollectOptions) !Module { var moddeps = std.ArrayList(Module).init(alloc); errdefer moddeps.deinit(); for (dep.deps) |*d| { - if (try common.get_module_from_dep(d, modpath, options)) |founddep| { + if (try common.get_module_from_dep(d, cachepath, options)) |founddep| { try moddeps.append(founddep); } } -- 2.54.0