-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
30 lines (20 loc) · 946 Bytes
/
index.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
import os from 'os';
import path from 'path';
const homeDirectory = os.homedir();
const {env} = process;
export const xdgData = env.XDG_DATA_HOME ||
(homeDirectory ? path.join(homeDirectory, '.local', 'share') : undefined);
export const xdgConfig = env.XDG_CONFIG_HOME ||
(homeDirectory ? path.join(homeDirectory, '.config') : undefined);
export const xdgState = env.XDG_STATE_HOME ||
(homeDirectory ? path.join(homeDirectory, '.local', 'state') : undefined);
export const xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? path.join(homeDirectory, '.cache') : undefined);
export const xdgRuntime = env.XDG_RUNTIME_DIR || undefined;
export const xdgDataDirectories = (env.XDG_DATA_DIRS || '/usr/local/share/:/usr/share/').split(':');
if (xdgData) {
xdgDataDirectories.unshift(xdgData);
}
export const xdgConfigDirectories = (env.XDG_CONFIG_DIRS || '/etc/xdg').split(':');
if (xdgConfig) {
xdgConfigDirectories.unshift(xdgConfig);
}