iteration over directories is unsafe

forkit forkit at gmail.com
Sat Feb 5 23:26:21 UTC 2022


It is not possible to do a simple iteration over directories in 
@safe mode.

Really? I have to resort to unsafe??


//----

module test;
@safe: // nope. no can do.

import std;

void main()
{
     auto dFiles = dirEntries("", "*.{d,di}", SpanMode.depth);
     foreach(d; dFiles)
         writeln(d.name);
}

//----



More information about the Digitalmars-d-learn mailing list