Skip to content

Commit c821ed2

Browse files
committed
fix(desktop): report launcher on path after removing its link
1 parent fc33954 commit c821ed2

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎apps/desktop/src/app/DesktopCliCommand.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,10 @@ it.layer(NodeServices.layer)("DesktopCliCommand", (it) => {
202202
expect(installed.shadowedBy).toBeUndefined();
203203
expect(yield* command.state).toEqual(installed);
204204

205-
expect((yield* command.uninstall).installedPath).toBeNull();
205+
const removed = yield* command.uninstall;
206+
expect(removed.installedPath).toBeNull();
207+
expect(removed.onPath).toBe(true);
208+
expect(yield* command.state).toEqual(removed);
206209
expect(yield* fs.exists(installed.installedPath!)).toBe(false);
207210
expect(yield* fs.exists(launcher)).toBe(true);
208211
}).pipe(Effect.scoped),

‎apps/desktop/src/app/DesktopCliCommand.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,17 @@ export const make = Effect.gen(function* () {
166166
const installed = yield* installedAt;
167167
const shadowedBy = yield* foreignFirstOnPath;
168168
const shadow = Option.isSome(shadowedBy) ? { shadowedBy: shadowedBy.value } : {};
169-
if (Option.isNone(installed)) {
170-
return { supported: true, installedPath: null, onPath: false, launcherPath, ...shadow };
171-
}
172169
const first = yield* firstOnPath;
173-
const onPath = windows || (Option.isSome(first) && (yield* runsOurLauncher(first.value)));
174-
return { supported: true, installedPath: installed.value, onPath, launcherPath, ...shadow };
170+
const onPath = windows
171+
? Option.isSome(installed)
172+
: Option.isSome(first) && (yield* runsOurLauncher(first.value));
173+
return {
174+
supported: true,
175+
installedPath: Option.getOrNull(installed),
176+
onPath,
177+
launcherPath,
178+
...shadow,
179+
};
175180
}).pipe(
176181
Effect.orElseSucceed(() => ({
177182
supported: false,

0 commit comments

Comments
 (0)