A Recurring Question
Jesse Phillips via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 18 13:24:40 PDT 2016
On Sunday, 17 April 2016 at 15:23:50 UTC, w0rp wrote:
> void main() {
> // Print all directories from this one up to and including
> /.
> getcwd()
> .unaryRecurrence!dirName
> .until("/", OpenRight.no)
> .each!writeln;
> }
FYI, OS independent version:
void main() {
// Print all directories from this one up to and including /.
getcwd()
.unaryRecurrence!dirName
.until(rootName(getcwd()), OpenRight.no)
.each!writeln;
}
Probably should also make a call to absolutePath.
More information about the Digitalmars-d
mailing list