[Scons-users] Node.FS get_path not working correctly?
Bill Deegan
bill at baddogconsulting.com
Mon May 28 18:56:29 EDT 2018
Do you need an absolute path for your use case?
On Mon, May 28, 2018 at 3:47 PM, Daniel Moody <dmoody256 at gmail.com> wrote:
> Ok but that's not the case in my example. Seems like it should have a
> special case if it's on another drive, which then it does return the
> abspath, because there is no relative path.
>
> On Mon, May 28, 2018, 5:36 PM Bill Deegan <bill at baddogconsulting.com>
> wrote:
>
>> That's the expected behavior. (Remember you could have a path on windows
>> which is on a different drive for which there is no relative path..)
>>
>> On Sun, May 27, 2018 at 9:18 PM, Daniel Moody <dmoody256 at gmail.com>
>> wrote:
>>
>>> It seems if I use get path with a file this is outside of the base build
>>> dir or I try to get a path relative to a dir that is in the base build dir,
>>> get_path just returns the abspath?
>>>
>>> The function comment seems to suggest it would be relative:
>>>
>>> def get_path(self, dir=None):
>>> """Return path relative to the current working directory of the
>>> Node.FS.Base object that owns us."""
>>>
>>> Let SConstruct be:
>>>
>>> import os
>>>
>>> env = Environment()
>>> test_file1_node = env.File(os.path.abspath('../outer/testFile1.txt'))
>>> test_file2_node = env.File(os.path.abspath('./inner/testFile2.txt'))
>>> test_file3_node = env.File(os.path.abspath('./inner2/testFile3.txt'))
>>> print(test_file1_node.get_path())
>>> print(test_file2_node.get_path())
>>> print(test_file3_node.get_path('./inner2'))
>>>
>>> I get this as output:
>>>
>>> scons: Reading SConscript files ...
>>> C:\Users\Daniel\workspace\test\outer\testFile1.txt
>>> inner\testFile2.txt
>>> C:\Users\Daniel\workspace\test\base\inner2\testFile3.txt
>>> scons: done reading SConscript files.
>>> scons: Building targets ...
>>> scons: `.' is up to date.
>>> scons: done building targets.
>>>
>>> Any ideas? I have a pull request to fix it if it is a bug.
>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180528/83c536df/attachment.html>
More information about the Scons-users
mailing list