'f'
mh-two-thousand-and-two
2024-04-12 26f2711ef9461961fb953e2b497bd314ef95e345
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const fs = require("fs");
const path = require("path");
function lookupChromeMac() {
    const bundles = ['com.google.Chrome.canary', 'com.google.Chrome'];
    function mdFind() {
        return new Promise((resolve, reject) => {
            child_process_1.exec(`mdfind 'kMDItemCFBundleIdentifier=${bundles[0]}'`, (err, stdout, stderr) => {
                const chromePath = stdout.trim();
                if (!err && fs.existsSync(chromePath)) {
                    resolve(path.join(chromePath, `/Contents/MacOS/${path.basename(chromePath, '.app')}`));
                }
                else {
                    bundles.shift();
                    if (bundles[0]) {
                        mdFind().then(resolve, reject);
                    }
                    else {
                        reject(err);
                    }
                }
            });
        });
    }
    return mdFind();
}
exports.default = lookupChromeMac;