Skip to content

Commit b62dca9

Browse files
committed
improve Wispr Flow detection across installation directories
1 parent f29e54a commit b62dca9

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

extensions/wispr-flow/src/platform.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { execFile } from "child_process";
2-
import { existsSync } from "fs";
2+
import { existsSync, readdirSync } from "fs";
33
import { homedir } from "os";
44
import { join } from "path";
55
import { promisify } from "util";
@@ -48,9 +48,29 @@ class WindowsPlatform implements PlatformAdapter {
4848
}
4949

5050
async isWisprFlowInstalled(): Promise<boolean> {
51-
const localAppData = process.env.LOCALAPPDATA;
52-
if (!localAppData) return false;
53-
return existsSync(join(localAppData, "WisprFlow", "Wispr Flow.exe"));
51+
const searchDirs = [
52+
process.env.LOCALAPPDATA ?? join(homedir(), "AppData", "Local"),
53+
process.env.PROGRAMFILES ?? "C:\\Program Files",
54+
process.env["PROGRAMFILES(X86)"] ?? "C:\\Program Files (x86)",
55+
];
56+
for (const base of searchDirs) {
57+
const wisprDir = join(base, "WisprFlow");
58+
if (!existsSync(wisprDir)) continue;
59+
if (existsSync(join(wisprDir, "Wispr Flow.exe"))) return true;
60+
try {
61+
if (
62+
readdirSync(wisprDir).some(
63+
(e) =>
64+
e.startsWith("app-") &&
65+
existsSync(join(wisprDir, e, "Wispr Flow.exe")),
66+
)
67+
)
68+
return true;
69+
} catch {
70+
/* continue */
71+
}
72+
}
73+
return false;
5474
}
5575

5676
async openWisprFlow(url: string): Promise<void> {

0 commit comments

Comments
 (0)