looking at dir(p) I don't see a direct way to determine where the
node is relative to @path and @<file> declarations.
what would you think of
p.getNodePath()
which would return either None or the @path this node lives in
p.getNodeFileName()
which would return either None or the filename of the @<file> this
node lives in.
Thanks,
Kent
The following probably does what you want for getNodePath:
aList = g.get_directives_dict_list(p)
path = c.scanAtPathDirectives(aList)
And this for getNodeFileName:
aList = g.get_directives_dict_list(p)
path = c.scanAtPathDirectives(aList)
filename = p.isAnyAtFileNode()
return filename and g.os_path_finalize_join(path,filename)
These use the load directory if there is no @path. These convenience
methods would have to be methods of the commands class:
path = c.getNodePath(p)
path = c.getNodeFileName(p)
I'll add these convenience methods if they do, in fact, do what you want.
BTW, there appears to be a bug with @path: the path is created when
any child is created, even if the child is no kind of @file node.
Edward
works for me.
>
> And this for getNodeFileName:
>
> aList = g.get_directives_dict_list(p)
> path = c.scanAtPathDirectives(aList)
> filename = p.isAnyAtFileNode()
> return filename and g.os_path_finalize_join(path,filename)
again, works for me.
>
> These use the load directory if there is no @path. These convenience
> methods would have to be methods of the commands class:
>
> path = c.getNodePath(p)
> path = c.getNodeFileName(p)
>
> I'll add these convenience methods if they do, in fact, do what you want.
>
> BTW, there appears to be a bug with @path: the path is created when
> any child is created, even if the child is no kind of @file node.
This is NOT a bug, but a really nice feature!
@path is not just for @files anymore
There's much sweetness in context aware @buttons;
@button do it here
...
node_path = c.getNodePath(p)
Popen(cmd, cwd=node_path)
>
> Edward
>
> >
>
> again, works for me.
Ok. I'll add these soon.
>> BTW, there appears to be a bug with @path: the path is created when
>> any child is created, even if the child is no kind of @file node.
>
> This is NOT a bug, but a really nice feature!
I'm not sure everyone will agree, but in the interest of laziness I'll
leave things alone until somebody complains :-)
Edward
Thanks!
>
> Edward
> >
>