Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 committed Jan 3, 2025
1 parent 14b2c3c commit 8903ae9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion source/dub/internal/io/mockfs.d
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ unittest {
version (Windows) immutable NativePath root = NativePath(`C:\`);
else immutable NativePath root = NativePath(`/`);

assert(fs.getcwd == root);
assert(fs.getcwd == root, fs.getcwd.toString());
// We shouldn't be able to chdir into a non-existent directory
assertThrown(fs.chdir(P("foo/bar")));
// Even with an absolute path
Expand Down
17 changes: 11 additions & 6 deletions source/dub/packagemanager.d
Original file line number Diff line number Diff line change
Expand Up @@ -894,12 +894,17 @@ class PackageManager {
alias PSegment = typeof(NativePath.init.head);
PSegment[] zip_prefix;
outer: foreach(ArchiveMember am; archive.directory) {
auto path = NativePath(am.name).bySegment.array;
foreach (fil; packageInfoFiles)
if (path.length == 2 && path[$-1].name == fil.filename) {
zip_prefix = path[0 .. $-1];
break outer;
}
try {
auto path = NativePath(am.name).bySegment.array;
foreach (fil; packageInfoFiles)
if (path.length == 2 && path[$-1].name == fil.filename) {
zip_prefix = path[0 .. $-1];
break outer;
}
} catch (Exception exc) {
logError("Error on: %s => %s", am.name, exc);
assert(0, exc.message);
}
}

logDebug("zip root folder: %s", zip_prefix);
Expand Down
3 changes: 2 additions & 1 deletion source/dub/test/selections_from_parent_dir.d
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ dependency "pkg1" version="*"`);
dub.loadPackage();
assert(dub.project.hasAllDependencies());
// the relative path should have been adjusted (`pkg1` => `../pkg1`)
assert(dub.project.selections.getSelectedVersion(PackageName("pkg1")).path == NativePath("../pkg1"));
assert(dub.project.selections.getSelectedVersion(PackageName("pkg1")).path == NativePath("../pkg1"),
dub.project.selections.getSelectedVersion(PackageName("pkg1")).path.toString());

// invoking `dub upgrade` for the pkg2 root package should generate a local dub.selections.json,
// leaving the inherited one untouched
Expand Down

0 comments on commit 8903ae9

Please sign in to comment.