Closed oneplusdash closed 5 years ago
This looks like it would fix the issue I'd been having with running pnpm on another partition. All of the cmd shims being generated in local project directories and the global directory were malformed. Thought I would let you know that the issue was also appearing in the Pwsh shims.
What I wound up doing as a workaround was resolving the real path before trying to find the relative path, and it's been working for me.
....
function generateCmdShim (src, to, opts) {
// `shTarget` is not used to generate the content.
const shTarget = path.relative(fs.realpathSync(path.dirname(to)), src)
....
function generatePwshShim (src, to, opts) {
let shTarget = path.relative(fs.realpathSync(path.dirname(to)), src)
....
generatePwshShim It should also be modified. In the author's version, the following situations can lead to problems:path.relative('C:/a', 'D:/a'))output: ../../D:/a
That returns 'D:\\a'
for me.
Please also cover it with tests
I'm looking into test coverage for this. Rather than create a second drive on Windows, I'm gonna see if we can use mock-fs.
There's a new PR for this #18
Relative path cannot be used under different partitions under windows