A Recurring Question

w0rp via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 18 16:18:00 PDT 2016


On Monday, 18 April 2016 at 20:24:40 UTC, Jesse Phillips wrote:
> 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.

Nice!


More information about the Digitalmars-d mailing list