Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 committed Jul 12, 2024
1 parent 28621e2 commit fe73ed3
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions source/dub/internal/io/mockfs.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public final class MockFS : Filesystem {

///
version (Windows) {
public this (char drive = 'C') scope
public this (string root = "C:") scope
{
this.cwd = new FSEntry(drive);
this.cwd = new FSEntry(root);
}
} else {
public this () scope
Expand Down Expand Up @@ -348,15 +348,12 @@ public class FSEntry
}

/// Create the root of the filesystem, only usable from this module
package(dub) this (char drive = 0)
package(dub) this (string name = null)
{
import std.datetime.date;
SysTime DefaultTime = SysTime(DateTime(2020, 01, 01));

if (drive) {
assert(drive >= 'A' && drive <= 'Z');
this.name = drive ~ `:\`;
}
this.name = name;
this.attributes.type = Type.Directory;
this.attributes.access = DefaultTime;
this.attributes.modification = DefaultTime;
Expand Down Expand Up @@ -451,11 +448,8 @@ public class FSEntry
/// Returns: The `path` of this FSEntry
public NativePath path () const scope
{
version (Windows) enum RootPath = "T:\\";
else enum RootPath = "/";

if (this.parent is null)
return NativePath(RootPath);
return this.name.length ? NativePath(this.name) : NativePath("/");
assert(!NativePath(this.name).absolute, this.name);
auto thisPath = this.parent.path ~ this.name;
thisPath.endsWithSlash = (this.attributes.type == Type.Directory);
Expand Down

0 comments on commit fe73ed3

Please sign in to comment.