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

anatoly techtonik techtonik at gmail.com
Fri Oct 2 04:15:20 EDT 2015


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20151002/d89c98e5/attachment.html>


More information about the Scons-dev mailing list