Raku / nqp-configure

Configuration and build modules for NQP
Artistic License 2.0
4 stars 8 forks source link

Make sure we don't strip `./` relative path markers from paths #13

Closed patrickbkr closed 5 years ago

patrickbkr commented 5 years ago

canonpath() is a nice thing to do to paths to make them more pleasing for the eye. But it also strips leading ./ which turns relative executables into ones resolved via PATH. That's plainly wrong. So go for less pretty but more correct.

vrurg commented 5 years ago

Does it really fix the problem? I'm generally not against removing canonpath as it really seems to be mostly useless in this statement and most likely it's a leftover of some earlier experimental code. But the main point is that ./ would not be preserved due to use of catdir:

⇒ perl -MFile::Spec -wE 'say File::Spec->catdir( File::Spec->splitdir("./a//b/c/") )'
a/b/c
patrickbkr commented 5 years ago

I did some more tests with the new code ($path to the left, nfp($path) to the right):

./asdf/perl6 -> asdf/perl6
./perl6 -> ./perl6
asdf/perl6 -> asdf/perl6
./$(M_RUNNER) -> ./$(M_RUNNER)

All of these do what we want. I tried making all of them output exactly the input by checking beforehand and adding a ./ afterwards, but given the above behaviour, this is non trivial.