diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 5eadc30..74b8542 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -192,7 +192,7 @@ if (!this.m_initialized) this.refresh(); - if (auto pkg = this.m_internal.lookup(name, vers, this)) + if (auto pkg = this.m_internal.lookup(name, vers)) return pkg; foreach (ref location; this.m_repositories) @@ -553,11 +553,9 @@ */ bool isManagedPath(NativePath path) const { - foreach (rep; m_repositories) { - NativePath rpath = rep.packagePath; - if (path.startsWith(rpath)) + foreach (rep; m_repositories) + if (rep.isManaged(path)) return true; - } return false; } @@ -1407,12 +1405,13 @@ * Returns: * A `Package` if one was found, `null` if none exists. */ - inout(Package) lookup(string name, Version ver, PackageManager mgr) inout { + inout(Package) lookup(string name, Version ver) inout { foreach (pkg; this.localPackages) if (pkg.name == name && pkg.version_.matches(ver, VersionMatchMode.standard)) return pkg; foreach (pkg; this.fromPath) { - auto pvm = mgr.isManagedPackage(pkg) ? VersionMatchMode.strict : VersionMatchMode.standard; + auto pvm = this.isManaged(pkg.basePackage.path) ? + VersionMatchMode.strict : VersionMatchMode.standard; if (pkg.name == name && pkg.version_.matches(ver, pvm)) return pkg; } @@ -1436,7 +1435,7 @@ */ Package load (string name, Version vers, PackageManager mgr) { - if (auto pkg = this.lookup(name, vers, mgr)) + if (auto pkg = this.lookup(name, vers)) return pkg; string versStr = vers.toString(); @@ -1472,6 +1471,11 @@ result.endsWithSlash = true; return result; } + + /// Determines if a specific path is within a DUB managed Location. + bool isManaged(NativePath path) const { + return path.startsWith(this.packagePath); + } } private immutable string OverrideDepMsg =