File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -5418,6 +5418,27 @@ if (is(Path == DirEntry))
5418
5418
if (subEntry.isDir)
5419
5419
chdir(subEntry.absolutePath);
5420
5420
}
5421
+
5422
+ /*
5423
+ This tests whether the “relative-path string” pitfall is still a thing.
5424
+ It can be removed later in case the underlying issue got fixed somehow.
5425
+ When doing so, one should make sure to delete the warning from the doc
5426
+ comment of `dirEntries` as well.
5427
+ */
5428
+ void traverseByString () @safe
5429
+ {
5430
+ chdir(root);
5431
+ scope (exit) chdir (origWD);
5432
+ foreach (string entry; " ." .dirEntries(SpanMode.shallow))
5433
+ {
5434
+ if (entry.isDir)
5435
+ foreach (string subEntry; entry.dirEntries(SpanMode.shallow))
5436
+ if (subEntry.isDir)
5437
+ chdir(subEntry.absolutePath);
5438
+ }
5439
+ }
5440
+ import std.exception : assertThrown;
5441
+ assertThrown(traverseByString());
5421
5442
}
5422
5443
5423
5444
/**
You can’t perform that action at this time.
0 commit comments