Windows and backslashes and replacements oh my!by stevieb (Canon)
|on Jun 18, 2021 at 14:28 UTC||Need Help??|
stevieb has asked for the wisdom of the Perl Monks concerning the following question:
Hey there my fellow esteemed Monks!
I've been having a long-running problem that I'm finally fed up enough with to ask for help.
In my test suite for berrybrew, I perform a path substitution in a configuration file before the tests load. The specific command which is run out of a batch script looks like this:
Essentially, that's supposed to change the path C:\berrybrew to C:\berrybrew\test.
On some of my Windows 10 systems, it works just fine, and everything goes on its merry way. On other Win10 systems, the change results in a tab character being inserted, so the path looks like this: C:\berrybrew[TAB]est. If I insert four backslashes in the replacement (ie. berrybrew\\\\test, it works. However, after a git push then a git pull on the other systems that work with just the two backslashes, it breaks.
What can I do to provide myself some consistency across systems? Is there some unicode trick or something I can use? I've tried replacing the forward slashes in the substitution to single-quotes (eg: s///; to s''';) to no avail.
I'd really like to get this resolved so that the substitution works reliably across all systems.