[Scons-dev] Proper way to get File path (undocumented rfile)

Jonathon Reinhart jonathon.reinhart at gmail.com
Fri Oct 2 10:07:36 EDT 2015


I, too have come across scenarios where rfile() was the only way to
accomplish exactly what I needed. I believe the scenario was this:

The arguments / command-line parameters to my external utility were so
complex, SCons couldn't handle it himself. So I wrote my own
variable-function-thing (like ${_concat}) in which I needed to expand the
Nodes to their paths, just like SCons would when expanding $TARGETS to
their paths. This is how I ended up finding rfile().

It seems like it should be documented.





On Fri, Oct 2, 2015 at 4:15 AM, anatoly techtonik <techtonik at gmail.com>
wrote:

> Hi,
>
> Currently the way to get filename from File node is to str() that File.
> That's quite shady API, especially if used in function like:
>
>     def convert(node):
>         return str(node).replace('\\', '/')
>
> I mean you have no idea what types of node are expected and why
> there is slash escaping. The str(node) can return anything and
> works on any types of nodes.
>
> So, there is undocumented method File.rfile() with the path.
> http://www.scons.org/doc/HTML/scons-api/SCons.Node.FS.File-class.html#rfile
> Which contains os specific path and it is used for example in
> https://github.com/wesnoth/wesnoth/pull/481/files
>
> The questions.
> 1. Why it is called rfile?
> 2. Should it be documented?
> 3. What should be the proper API to get path info for File node?
> 4. What is the proper API to convert paths to system-specific and to
> canonical (forward slash) form?
> --
> anatoly t.
>
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
>


-- 
Computers are incredibly fast, accurate and stupid. Human beings are
incredibly slow, inaccurate and brilliant. Together they are powerful
beyond imagination.
                                    A. Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20151002/97bfc09a/attachment.html>


More information about the Scons-dev mailing list