bun
bun copied to clipboard
[win][fs] `path.toNamespacedPath` does nothing
What version of Bun is running?
1.0.23
What platform is your computer?
Window 10
What steps can reproduce the bug?
import path from "node:path";
const fp1 = "C:\\Downloads\\bun-windows-x64\\bun.exe";
const fp2 = "bun.exe";
const fp3 = "\\\\KEENETIC\\USB";
const fp4 = "\\\\KEENETIC\\USB\\A";
console.log(path.toNamespacedPath(fp1));
console.log(path.toNamespacedPath(fp2));
console.log(path.toNamespacedPath(fp2) === "\\\\?\\" + path.resolve(fp2));
console.log(path.toNamespacedPath(fp3));
console.log(path.toNamespacedPath(fp4));
What is the expected behavior?
\\?\C:\Downloads\bun-windows-x64\bun.exe
\\?\C:\Downloads\bun-windows-x64\bun.exe
true
\\?\UNC\KEENETIC\USB\
\\?\UNC\KEENETIC\USB\A
What do you see instead?
C:\Downloads\bun-windows-x64\bun.exe
bun.exe
false
\\KEENETIC\USB
\\KEENETIC\USB\A
Additional information
Rel:
- https://github.com/oven-sh/bun/issues/8246
- https://github.com/oven-sh/bun/issues/8836
- https://github.com/oven-sh/bun/issues/8248
Context: https://nodejs.org/api/path.html#pathtonamespacedpathpath https://github.com/oven-sh/bun/blob/c21dc25a6546f0b74af62f4826fcf2a494805882/src/bun.js/bindings/Path.cpp#L125-L127
See zig's wToPrefixedFileW
Fixed in #8469