Skip to content

Commit

Permalink
fix: Ensure nameless FSEntry cannot be constructed
Browse files Browse the repository at this point in the history
We currently do not expect to have nameless FSEntry save for the root,
so add an assertiong that would catch such a case. If a use case arise,
this can always be removed.
  • Loading branch information
Geod24 committed Jan 3, 2025
1 parent 362452f commit 6262eca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/dub/internal/io/mockfs.d
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ public class FSEntry
import std.datetime.date;
SysTime DefaultTime = SysTime(DateTime(2020, 01, 01));

assert(n.length > 0,
"FSentry.this(%s, %s, %s) called with empty name"
.format(p.path(), t, n));

this.attributes.type = t;
this.parent = p;
this.name = n;
Expand Down

0 comments on commit 6262eca

Please sign in to comment.