fix(coding-agent): build WSL mount fallback paths with POSIX semantics
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- WSL host-home resolution now builds `/mnt/<drive>/...` fallback paths with POSIX semantics regardless of the host platform, instead of the platform-dependent `path` module ([#3779](https://github.com/can1357/oh-my-pi/issues/3779)).
|
||||
|
||||
## [17.2.9] - 2026-08-05
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
@@ -44,12 +44,14 @@ function isWsl(platform: NodeJS.Platform, env: NodeJS.ProcessEnv): boolean {
|
||||
function convertWindowsPathToDefaultWslMount(windowsPath: string): string | undefined {
|
||||
const trimmed = windowsPath.trim();
|
||||
if (trimmed.length === 0) return undefined;
|
||||
if (path.isAbsolute(trimmed)) return path.normalize(trimmed);
|
||||
// The result is always a WSL (POSIX) path, so build it with posix
|
||||
// semantics regardless of the host platform.
|
||||
if (path.posix.isAbsolute(trimmed)) return path.posix.normalize(trimmed);
|
||||
const match = WINDOWS_DRIVE_PROFILE_PATTERN.exec(trimmed);
|
||||
if (!match) return undefined;
|
||||
const [, drive, rest] = match;
|
||||
const segments = rest.replace(/\\/g, "/").split("/").filter(Boolean);
|
||||
return path.join("/mnt", drive.toLowerCase(), ...segments);
|
||||
return path.posix.join("/mnt", drive.toLowerCase(), ...segments);
|
||||
}
|
||||
|
||||
function resolveWithWslPath(windowsPath: string): string | undefined {
|
||||
|
||||
@@ -284,7 +284,7 @@ describe("skills", () => {
|
||||
wslPath: () => undefined,
|
||||
});
|
||||
|
||||
expect(resolved).toBe(path.join("/mnt", "c", "Users", "alice"));
|
||||
expect(resolved).toBe("/mnt/c/Users/alice");
|
||||
});
|
||||
|
||||
it("resolves the Windows profile through interop when USERPROFILE is not exported (#3779)", () => {
|
||||
|
||||
Reference in New Issue
Block a user