Skip to content

Commit 8be906a

Browse files
committed
Fix issue 11000
1 parent 8a42656 commit 8be906a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

std/datetime/timezone.d

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,16 +2449,17 @@ public:
24492449
}
24502450
else
24512451
{
2452-
import std.path : baseName;
2453-
// dirEntries is @system because it uses a DirIterator with a
2454-
// RefCounted variable, but here, no references to the payload is
2455-
// escaped to the outside, so this should be @trusted
2452+
import std.path : baseName, relativePath;
2453+
// dirEntries might be @system because it uses a DirIterator with a
2454+
// SafeRefCounted variable that's only safe under DIP1000, but
2455+
// here no references to the payload are escaped to the outside,
2456+
// so this should be @trusted.
24562457
() @trusted {
24572458
foreach (DirEntry de; dirEntries(tzDatabaseDir, SpanMode.depth))
24582459
{
24592460
if (de.isFile)
24602461
{
2461-
auto tzName = de.name[tzDatabaseDir.length .. $];
2462+
auto tzName = relativePath(de.name, tzDatabaseDir);
24622463

24632464
if (!tzName.extension().empty ||
24642465
!tzName.startsWith(subName) ||

0 commit comments

Comments
 (0)