Skip to content

Commit

Permalink
fix: add support for 'Program Files (x86)' path (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymelon authored Jan 6, 2025
1 parent c1536b2 commit 2c99bff
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/src/utils/browser.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import fs from 'fs';
import path from "path";
import { Page } from "puppeteer-core";

export const getChromeExecutablePath = () => {
if (process.platform === "win32") {
return `${process.env["ProgramFiles"]}\\Google\\Chrome\\Application\\chrome.exe`;
const programFilesPath = `${process.env["ProgramFiles"]}\\Google\\Chrome\\Application\\chrome.exe`;
const programFilesX86Path = `C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe`;

if (fs.existsSync(programFilesPath)) {
return programFilesPath;
} else if (fs.existsSync(programFilesX86Path)) {
return programFilesX86Path;
}
}

if (process.platform === "darwin") {
Expand Down

0 comments on commit 2c99bff

Please sign in to comment.