windows 8.1 and dirEntries

Stephen Jones siwenjo at gmail.com
Fri Dec 27 12:04:38 PST 2013


Thanks Ali. Stupid of me, it is the dirEntries call that opens 
the directory and tries to read contents. I did this (below), but 
it still leaves the odd situation that Documents and Settings 
cannot be opened, and surely non-administrators have access to 
this folder.

try{
   auto dirs =  dirEntries(directory, SpanMode.shallow, false);

   foreach(DirEntry ent; dirs){
     if(ent.isDir) d ~= ent.name;
     if(ent.isFile){
       if(endsWith(ent.name, sufix)) f ~= ent.name;
     }
   }
}catch(FileException ex){
   writeln("Error reading directory, probably no administrator 
privilege");
} finally{}



More information about the Digitalmars-d-learn mailing list