diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 0777f199f..ff19601cc 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -1442,26 +1442,29 @@ package struct Location { // Packages are stored in $ROOT/$SOMETHING/` const pack_path = path ~ (pdir.name ~ "/"); auto packageFile = Package.findPackageFile(pack_path); - if (!packageFile.empty) { - // Deprecated unmanaged directory structure - logWarn("Package at path '%s' should be under '%s'", - pack_path.toNativeString().color(Mode.bold), - (pack_path ~ "$VERSION" ~ pdir.name).toNativeString().color(Mode.bold)); - logWarn("The package will no longer be detected starting from v1.42.0"); - loadInternal(pack_path, packageFile); - } - - // Managed structure: $ROOT/$NAME/$VERSION/$NAME - // This is the most common code path - else { - // Iterate over versions of a package - foreach (versdir; mgr.iterateDirectory(pack_path)) { - if (!versdir.isDirectory) continue; - auto vers_path = pack_path ~ versdir.name ~ (pdir.name ~ "/"); - if (!mgr.existsDirectory(vers_path)) continue; - packageFile = Package.findPackageFile(vers_path); - loadInternal(vers_path, packageFile); + if (isManaged(path)) { + if (!packageFile.empty) { + // Deprecated unmanaged directory structure + logWarn("Package at path '%s' should be under '%s'", + pack_path.toNativeString().color(Mode.bold), + (pack_path ~ "$VERSION" ~ pdir.name).toNativeString().color(Mode.bold)); + logWarn("The package will no longer be detected starting from v1.42.0"); + loadInternal(pack_path, packageFile); + } else { + // Managed structure: $ROOT/$NAME/$VERSION/$NAME + // This is the most common code path + // Iterate over versions of a package + foreach (versdir; mgr.iterateDirectory(pack_path)) { + if (!versdir.isDirectory) continue; + auto vers_path = pack_path ~ versdir.name ~ (pdir.name ~ "/"); + if (!mgr.existsDirectory(vers_path)) continue; + packageFile = Package.findPackageFile(vers_path); + loadInternal(vers_path, packageFile); + } } + } else { + if (!packageFile.empty) + loadInternal(pack_path, packageFile); } } catch (Exception e)