'Get node path relative to the SConstruct from inside a SConscript
In a hierarchical build, one of my SConscript files, located in a sub-directory needs to print paths of a few nodes (for use by an external script). However, the paths need to be relative to the main directory, in which SConstruct resides, not to the sub-directory I'm currently in.
The functions I'm normally use to get node paths are str(node) and node.get_path(). Both of them return the path relative to the sub-directory.
How can I get a path relative to the root directory of the project?
Solution 1:[1]
Node object have two properties that appear to store paths relative to the root directory:
node.pathnode.relpath
Their descriptions are kinda similar, although, from what information I've managed to gather, node.path is preferable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
