Don't modify environment variable with tokeniser
We need to make a copy of the paths environment variable here, because below this we're using strtok which modifies the original string. So the next time you call this function, you get a different result. Now it stays the same every time, which is better.
Contributes to issue CURA-4410.