Skip to content

Commit

Permalink
packagesuppliers/filesystem.d: Only glob versions of a package_id
Browse files Browse the repository at this point in the history
When looking for versions of a package don't include other packages
that start with the same name as the queried package. This is done
by requiring that the first character after the - is a digit.

If a directory contains the files botan-1.zip and botan-math-2.zip
the current implementation would report both 1 and math-2 as
candidates followed by an error that math-2 is not a valid version.

Signed-off-by: Andrei Horodniceanu <[email protected]>
  • Loading branch information
the-horo committed Dec 17, 2023
1 parent afaf10a commit 9e5dbd2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/dub/packagesuppliers/filesystem.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FileSystemPackageSupplier : PackageSupplier {
import std.file : dirEntries, DirEntry, SpanMode;
import std.conv : to;
Version[] ret;
foreach (DirEntry d; dirEntries(m_path.toNativeString(), package_id~"*", SpanMode.shallow)) {
foreach (DirEntry d; dirEntries(m_path.toNativeString(), package_id~"-[0123456789]*", SpanMode.shallow)) {
NativePath p = NativePath(d.name);
logDebug("Entry: %s", p);
enforce(to!string(p.head)[$-4..$] == ".zip");
Expand Down

0 comments on commit 9e5dbd2

Please sign in to comment.