Skip to content

Commit

Permalink
debug1
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 committed Jan 6, 2025
1 parent ce2b9bf commit 15a86fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/dub/internal/io/mockfs.d
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public final class MockFS : Filesystem {

public override void chdir (in NativePath path) scope
{
auto tmp = this.lookup(path);
auto tmp = this.lookup(path, true);
enforce(tmp !is null, "No such directory: " ~ path.toNativeString());
enforce(tmp.isDirectory(), "Cannot chdir into non-directory: " ~ path.toNativeString());
this.cwd = tmp;
Expand Down Expand Up @@ -302,14 +302,18 @@ public final class MockFS : Filesystem {
}

/// Get an arbitrarily nested children node
protected inout(FSEntry) lookup(NativePath path) inout return scope
protected inout(FSEntry) lookup(NativePath path, bool dbg = false) inout return scope
{
import std.algorithm.iteration : reduce;

const abs = path.absolute();
auto segments = path.bySegment;
// `library-nonet` (using vibe.d) has an empty front for absolute path,
// while our built-in module (in vibecompat) does not.
if (dbg) {
import std.stdio;
writeln("lookup: ", path, ", abs: ", abs, ", bySegment: ", path.bySegment);
}
if (abs && segments.front.name.length == 0) segments.popFront();
// Casting away constness because no good way to do this with `inout`,
// but `FSEntry.lookup` is `inout` too.
Expand Down

0 comments on commit 15a86fd

Please sign in to comment.