unjs / pathe

🛣️ Drop-in replacement of the Node.js's path module module that ensures paths are normalized

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`relative` judgment error in win32 when `from` and `to` in different disk

peterroe opened this issue · comments

commented

Environment

Node: 16
pathe: 1.1.1

Reproduction

import pathe from 'pathe'
import path from 'path'
pathe.relative("C:\\foo", "D:\\bar") // => ../../D:/bar
path.relative("C:\\foo", "D:\\bar") //=> D:\bar

Describe the bug

function relative(from, to) {
  //...
}

When the paths from and to are on different disks, the return value should be the value of to.

Additional context

No response

Logs

No response