MCPcopy Index your code
hub / github.com/darkreader/darkreader / getFirefoxPath

Function getFirefoxPath

tests/browser/paths.js:81–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

79 * @returns {Promise<string>}
80 */
81export async function getFirefoxPath() {
82 if (process.platform === 'darwin') {
83 return '/Applications/Firefox Nightly.app/Contents/MacOS/firefox';
84 }
85 if (process.platform === 'win32') {
86 return await winProgramFiles('Firefox Nightly\\firefox.exe');
87 }
88 const possibleLinuxPaths = ['firefox-nightly', 'firefox'];
89 for (const possiblePath of possibleLinuxPaths) {
90 try {
91 // snap profile folders do not get loaded
92 const option = await linuxAppPath(possiblePath);
93 // Firefox snap can not access the regular system-wide temporary directory,
94 // so we create a separate one within build folder
95 // See also: https://github.com/mozilla/web-ext/issues/1696
96 if (!option.includes('/snap/')) {
97 return option;
98 }
99 const firefoxProfile = './build/firefox-profile-for-testing';
100 process.env.TMPDIR = firefoxProfile;
101 try {
102 fs.mkdirSync(firefoxProfile);
103 } catch (e) {
104 // Do nothing
105 }
106 return option;
107 } catch (e) {
108 // ignore
109 }
110 }
111 throw new Error('Could not find firefox-nightly');
112}
113
114export const chromeExtensionDebugDir = path.join(__dirname, '../../build/debug/chrome');
115export const chromePlusExtensionDebugDir = path.join(__dirname, '../../build/debug/chrome-plus');

Callers 1

launchFirefoxMethod · 0.90

Calls 2

winProgramFilesFunction · 0.85
linuxAppPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…