www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - createPath()

reply "Chris Miller" <chris dprogramming.com> writes:
I wrote this function to create any number of nesting directories all at  
once with one directory path. Someone needed it so I'm releasing it:   
http://paste.dprogramming.com/dpqr1tya.php
Would be handy to add to std.file
Nov 26 2006
parent "Chris Miller" <chris dprogramming.com> writes:
Updated how it handles network share paths:  =

http://paste.dprogramming.com/dpilny6l.php


After testing with network shares I realized that std.path.isabs() shoul=
d  =

probably test for network share paths and consider them absolute.
Consider the following, which I often do:
    if(!std.path.isabs(mypath))
       mypath =3D std.path.join(getcwd(), mypath);
where mypath is `\\foo\bar`

Fix for isabs:
    version(Windows)
    {
       if(path.length >=3D 2 && r"\\" =3D=3D path[0 .. 2])
          return true;
    }
    // ..continue with existing code..
Dec 08 2006