Skip to content

Commit 3965542

Browse files
Aquaspacesclaude
andcommitted
fix(server): opening a folder in File Explorer no longer lands on the wrong folder
Explorer reads `/` as the start of a switch, so a forward-slash Windows path opened a default folder instead of the target. Convert the path with the existing normalizeWindowsFileManagerPath, as the reveal launch already does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5fe7568 commit 3965542

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎apps/server/src/process/externalLauncher.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,34 @@ it.effect("launches Cursor in classic IDE mode through the Windows command shim"
251251
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
252252
);
253253

254+
it.effect("opens a folder in File Explorer with Windows separators", () =>
255+
Effect.gen(function* () {
256+
const fileSystem = yield* FileSystem.FileSystem;
257+
const path = yield* Path.Path;
258+
const binDir = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-editors-" });
259+
yield* fileSystem.writeFileString(path.join(binDir, "explorer.EXE"), "");
260+
261+
let spawned: ChildProcess.StandardCommand | undefined;
262+
yield* Effect.gen(function* () {
263+
const launcher = yield* ExternalLauncher.ExternalLauncher;
264+
yield* launcher.launchEditor({ editor: "file-manager", cwd: "C:/workspace/project" });
265+
}).pipe(
266+
Effect.provide(
267+
layerTest({
268+
platform: "win32",
269+
env: { PATH: binDir, PATHEXT: ".COM;.EXE;.BAT;.CMD" },
270+
onSpawn: (command) => {
271+
spawned = command;
272+
},
273+
}),
274+
),
275+
);
276+
277+
assert.ok(spawned);
278+
assert.deepEqual(spawned.args, ["C:\\workspace\\project"]);
279+
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
280+
);
281+
254282
it.effect.skipIf(windowsHost)("reveals a file in Finder with open -R on macOS", () =>
255283
Effect.gen(function* () {
256284
const fileSystem = yield* FileSystem.FileSystem;

‎apps/server/src/process/externalLauncher.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,11 @@ const resolveEditorLaunch = Effect.fn("resolveEditorLaunch")(function* (
577577
args:
578578
command === "explorer.exe" && env.WSL_DISTRO_NAME !== undefined
579579
? [resolveWslFileManagerPath(input.cwd, env.WSL_DISTRO_NAME)]
580-
: [input.cwd],
580+
: platform === "win32"
581+
? // Explorer reads `/` as a switch, so `C:/repo` silently opens
582+
// a default folder instead of the target.
583+
[normalizeWindowsFileManagerPath(input.cwd)]
584+
: [input.cwd],
581585
};
582586
});
583587

0 commit comments

Comments
 (0)