From 6262eca2d3135865620d53fd58dfef64195669b0 Mon Sep 17 00:00:00 2001 From: Mathias Lang Date: Fri, 3 Jan 2025 15:26:28 +0100 Subject: [PATCH] fix: Ensure nameless FSEntry cannot be constructed 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. --- source/dub/internal/io/mockfs.d | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/dub/internal/io/mockfs.d b/source/dub/internal/io/mockfs.d index ade5adec9..25133ad1c 100644 --- a/source/dub/internal/io/mockfs.d +++ b/source/dub/internal/io/mockfs.d @@ -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;