[Toybox] mkpathat() behavior

Ashwini Sharma ak.ashwini1981 at gmail.com
Thu May 8 21:05:43 PDT 2014


Thanks for clearing the usage part of mkpathat()

regards,
Ashwini


On Wed, May 7, 2014 at 10:28 PM, Rob Landley <rob at landley.net> wrote:

> On 05/07/14 04:52, Ashwini Sharma wrote:
> > Hi Rob, list,
> >
> > __mkpathat()__ function doesn't create the last component in the given
> path
> > if (flags & 1) == 0, e.g. input path is "a/b/c" and flags = 2, then __a__
> > and __b__ are created but __c__ isn't.
>
> That's right. If you have a path to a directory and want to create the
> entire thing, use flags = 3.
>
> If you have a path to a file and just want to create the directory leading
> up to that file (or confirm it exists and is a directory), use flags = 2.
>
> If you want to use it as just "mkdir", flags = 1.
>
> Then add the verbose flag if you want it to say what it's doing.
>
> > Is it expecting the filename also in the path component, to make the path
> > recursively.
>
> If it's a path to a file, yes. If it's not a path to a file, feed it just
> the path and use flags=3.
>
> > I guess it shouldn't otherwise it defies the purpose of mkpathat().
>
> I don't understand. Could you explain your use case?
>
> Mostly likely I didn't document it well enough, but I may be missing
> something...
>
> > regards,
> > Ashwini
>
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20140509/5a5321f4/attachment-0002.htm>


More information about the Toybox mailing list