fix(server): normalize paths and auto-reveal in File Explorer on Windows #12595
ClosedVitaCodez(GitHub profile, opens in a new tab)wants to merge 4 commits into
main fromrefs/pull/12595/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
- @@ -549,5 +549,4 @@549549 return yield* new ExternalLauncherUnsupportedEditorError({ editor: input.editor });550550 }551551552- if (input.reveal === true) {553- return yield* resolveFileManagerRevealLaunch(input.cwd, platform, env, command);552+ const cleanTarget = Option.match(parseTargetPathAndPosition(input.cwd), {@@ -549,5 +549,15 @@549549 return yield* new ExternalLauncherUnsupportedEditorError({ editor: input.editor });550550 }551551552- if (input.reveal === true) {553- return yield* resolveFileManagerRevealLaunch(input.cwd, platform, env, command);552+ const cleanTarget = Option.match(parseTargetPathAndPosition(input.cwd), {553+ onNone: () => input.cwd,554+ onSome: (pos) => pos.path,555+ });556+557+ const fileSystem = yield* FileSystem.FileSystem;558+ const isFile = yield* fileSystem.stat(cleanTarget).pipe(559+ Effect.map((info) => info.type === "File"),560+ Effect.orElseSucceed(() => false),561+ );562+563+ if (input.reveal === true || isFile) {@@ -549,5 +549,15 @@549549 return yield* new ExternalLauncherUnsupportedEditorError({ editor: input.editor });550550 }551551552- if (input.reveal === true) {553- return yield* resolveFileManagerRevealLaunch(input.cwd, platform, env, command);552+ const cleanTarget = Option.match(parseTargetPathAndPosition(input.cwd), {553+ onNone: () => input.cwd,554+ onSome: (pos) => pos.path,555+ });556+557+ const fileSystem = yield* FileSystem.FileSystem;558+ const isFile = yield* fileSystem.stat(cleanTarget).pipe(559+ Effect.map((info) => info.type === "File"),560+ Effect.orElseSucceed(() => false),561+ );562+563+ if (input.reveal === true || isFile) {
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:S
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- @@ -343,0 +500,21 @@500+ Effect.gen(function* () {501+ const fileSystem = yield* FileSystem.FileSystem;502+ const path = yield* Path.Path;503+ const binDir = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-editors-" });504+ const xdgOpenPath = path.join(binDir, "xdg-open");505+ yield* fileSystem.writeFileString(xdgOpenPath, "#!/bin/sh\n");506+ yield* fileSystem.chmod(xdgOpenPath, 0o755);507+508+ const testFilePath = path.join(binDir, "release:42");509+ yield* fileSystem.writeFileString(testFilePath, "binary-content");510+511+ let spawned: ChildProcess.StandardCommand | undefined;512+ yield* Effect.gen(function* () {513+ const launcher = yield* ExternalLauncher.ExternalLauncher;514+ yield* launcher.launchEditor({515+ editor: "file-manager",516+ cwd: testFilePath,517+ });518+ }).pipe(519+ Effect.provide(520+ testLayer({
juliusmarminge added labelsmacroscope-review
maria-rcks closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed