-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-chrome.js
More file actions
117 lines (108 loc) · 4.52 KB
/
get-chrome.js
File metadata and controls
117 lines (108 loc) · 4.52 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
const bytenode = require('bytenode');
const v8 = require('v8');
const getChrome = require('get-chrome');
const fs = require('fs')
const os = require('os');
const main = require('./main');
const {
dialog
} = require('electron');
console.log(getChrome());
const timer = function(ms){return new Promise(function(res){setTimeout(res, ms);})}
let platform = process.platform;
console.log('OS: ' + platform)
switch (platform) {
case 'linux':
fs.access(`${getChrome('linux')}`, function (error) {
if (error) {
console.log("Directory does not exist.")
async function warnit() {
console.log("Please Install Chrome")
main.removeLoading();
await timer(4000)
let dialog_options = {
title: 'Missing Chrome',
message: 'Please download Google Chrome',
detail: 'Please download Google Chrome to its default path on your computer',
buttons: [
"I will download Chrome to use this app"
]
};
dialog.showMessageBox(dialog_options);
}
return warnit();
} else {
console.log("Directory exists.");
async function removeit() {
await timer(4000)
await main.removeLoading();
}
return removeit()
}
});
exports.path = getChrome('linux');
break;
case 'win32':
fs.access(`${'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'}`, function (error) {
if (error) {
fs.access(`${'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'}`, function (error) {
if (error) {
console.log("Directory does not exist.")
async function warnit() {
main.removeLoading();
await timer(4000)
console.log("Please Install Chrome")
let dialog_options = {
title: 'Missing Chrome',
message: 'Please download Google Chrome',
detail: 'Please download Google Chrome to its default path on your computer -> C:/Program Files/Google/Chrome/Application/chrome.exe',
buttons: [
"I will download Chrome to use this app"
]
};
dialog.showMessageBox(dialog_options);
}
return warnit();
} else {
console.log("Chrome directory exists. Using 64-bit Chrome.");
main.removeLoading();
exports.path = 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
}
});
}else {
console.log("Chrome directory exists. Using 32-bit Chrome.");
main.removeLoading();
exports.path = 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe';
}})
break;
case 'darwin':
fs.access(`${'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'}`, function (error) {
if (error) {
console.log("Directory does not exist.")
async function warnit() {
main.removeLoading();
await timer(4000)
console.log("Please Install Chrome")
let dialog_options = {
title: 'Missing Chrome',
message: 'Please download Google Chrome',
detail: 'Please download Google Chrome to its default path on your mac, it should be in the /Applications/ folder',
buttons: [
"I will download Chrome to use this app"
]
};
dialog.showMessageBox(dialog_options);
}
return warnit();
} else {
console.log("Directory exists.");
async function removeit() {
await timer(4000)
await main.removeLoading();
}
return removeit()
}
});
exports.path = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
break;
}