-
Notifications
You must be signed in to change notification settings - Fork 22
/
history_paths.js
58 lines (50 loc) · 2.75 KB
/
history_paths.js
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
const Path = require('path');
const homeDirectory = process.env.HOME;
function setupForWindows() {
let defaultPaths = {}
const appDataDirectory = Path.join(process.env.HOMEDRIVE, "Users", process.env.USERNAME, "AppData");
defaultPaths.chrome = Path.join(appDataDirectory, "Local", "Google", "Chrome");
defaultPaths.avast = Path.join(appDataDirectory, "Local", "Google", "AVAST Software");
defaultPaths.firefox = Path.join(appDataDirectory, "Roaming", "Mozilla", "Firefox");
defaultPaths.opera = Path.join(appDataDirectory, "Roaming", "Opera Software");
defaultPaths.edge = Path.join(appDataDirectory, "Local", "Microsoft", "Edge");
defaultPaths.torch = Path.join(appDataDirectory, "Local", "Torch", "User Data");
defaultPaths.seamonkey = Path.join(appDataDirectory, "Roaming", "Mozilla", "SeaMonkey");
defaultPaths.brave = Path.join(appDataDirectory, "Local", "BraveSoftware", "Brave-Browser", "User Data");
defaultPaths.vivaldi = Path.join(appDataDirectory, "Local", "Vivaldi", "User Data");
return defaultPaths
}
function setupForMac() {
let defaultPaths = {}
defaultPaths.chrome = Path.join(homeDirectory, "Library", "Application Support", "Google", "Chrome");
defaultPaths.avast = Path.join(homeDirectory, "Library", "Application Support", "AVAST Software", "Browser");
defaultPaths.firefox = Path.join(homeDirectory, "Library", "Application Support", "Firefox");
defaultPaths.edge = Path.join(homeDirectory, "Library", "Application Support", "Microsoft Edge");
defaultPaths.opera = Path.join(homeDirectory, "Library", "Application Support", "com.operasoftware.Opera");
defaultPaths.maxthon = Path.join(homeDirectory, "Library", "Application Support", "com.maxthon.mac.Maxthon");
defaultPaths.vivaldi = Path.join(homeDirectory, "Library", "Application Support", "Vivaldi");
defaultPaths.seamonkey = Path.join(homeDirectory, "Library", "Application Support", "SeaMonkey", "Profiles");
defaultPaths.brave = Path.join(homeDirectory, "Library", "Application Support", "BraveSoftware", "Brave-Browser");
return defaultPaths;
}
function setupForLinux() {
let defaultPaths = {}
defaultPaths.firefox = Path.join(homeDirectory, ".mozilla", "firefox");
defaultPaths.chrome = Path.join(homeDirectory, ".config", "google-chrome");
return defaultPaths
}
function setupDefaultPaths(defaultPaths) {
switch (process.platform) {
case 'darwin':
return setupForMac(defaultPaths);
case 'linux':
return setupForLinux(defaultPaths);
case 'win32':
return setupForWindows(defaultPaths);
default:
console.error(`Platform ${process.platform} is not supported by node-browser-history`);
}
}
module.exports = {
setupDefaultPaths
};