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