Skip to content

Commit

Permalink
fix: apps lookup issue on windows (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 authored Jul 8, 2024
1 parent 02b699a commit 481caf9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/platforms/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function importByPlatform() {
switch (process.platform) {
// case "win32":
// return import("../platforms/win");
case "win32":
return import("../platforms/win");
case "darwin":
return import("./macos");
case "linux":
Expand Down
15 changes: 12 additions & 3 deletions src/main/platforms/win.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { AppInfo } from "../reducers/app";
import type { AppInfo } from "../../reducer";
import type { AppReader } from "./utils";
import fs from "fs";
import path from "path";
Expand Down Expand Up @@ -135,9 +135,18 @@ export const adapter: AppReader = {
"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
),
];
return Promise.all(
items.map((itemValues) => getAppInfoFromRegeditItemValues(itemValues)),

const results = await Promise.all(
items.map((itemValues) =>
Result.wrapAsync(async () =>
getAppInfoFromRegeditItemValues(itemValues),
),
),
);

const apps = results.flatMap((app) => (app.ok ? [app.unwrap()] : []));

return apps;
}),

readByPath: (p: string) =>
Expand Down

0 comments on commit 481caf9

Please sign in to comment.