Skip to content

Commit

Permalink
Update path module to [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 committed Jan 3, 2025
1 parent f36bed9 commit 8a7211c
Show file tree
Hide file tree
Showing 8 changed files with 1,882 additions and 446 deletions.
1 change: 1 addition & 0 deletions build-files.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ source/dub/internal/vibecompat/data/json.d
source/dub/internal/vibecompat/data/serialization.d
source/dub/internal/vibecompat/data/utils.d
source/dub/internal/vibecompat/inet/path.d
source/dub/internal/vibecompat/inet/path2.d
source/dub/internal/vibecompat/inet/url.d
source/dub/internal/colorize/colors.d
source/dub/internal/colorize/cwrite.d
Expand Down
2 changes: 2 additions & 0 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ configuration "library" {
}

configuration "library-nonet" {
dependency "vibe-core" version="~>2" optional=true
dependency "vibe-d:http" version=">=0.9.0 <0.11.0" optional=true
targetType "library"
excludedSourceFiles "source/app.d"
}

configuration "dynamic-library-nonet" {
dependency "vibe-core" version="~>2" optional=true
dependency "vibe-d:http" version=">=0.9.0 <0.11.0" optional=true
targetType "dynamicLibrary"
excludedSourceFiles "source/app.d"
Expand Down
7 changes: 7 additions & 0 deletions source/dub/internal/io/mockfs.d
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ public class FSEntry
/// Creates a new FSEntry
package(dub) this (FSEntry p, Type t, string n)
{
assert(n.length);

// Avoid 'DOS File Times cannot hold dates prior to 1980.' exception
import std.datetime.date;
SysTime DefaultTime = SysTime(DateTime(2020, 01, 01));
Expand Down Expand Up @@ -392,6 +394,9 @@ public class FSEntry
`FSEntry.lookup should not be called with absolute paths`);
auto segments = path.bySegment;
if (segments.empty) return this;
// `/foo`.bySegment results in [`/`, `foo`] so drop the `/`
if (!segments.front.name.length && this.parent is null)
segments.popFront();
if (auto next = this.lookup(segments.front.name)) {
segments.popFront();
return next.lookup(NativePath(segments));
Expand Down Expand Up @@ -470,6 +475,8 @@ public class FSEntry
.format(this.path, path));
// Check if the child already exists
auto segments = path.bySegment;
if (!segments.front.name.length && this.parent is null)
segments.popFront();
auto child = this.lookup(segments.front.name);
if (child is null) {
child = new FSEntry(this, Type.Directory, segments.front.name);
Expand Down
Loading

0 comments on commit 8a7211c

Please sign in to comment.