2 const os = require('os');
3 const path = require('path');
5 const home = os.homedir();
6 const env = process.env;
8 exports.data = env.XDG_DATA_HOME ||
9 (home ? path.join(home, '.local', 'share') : null);
11 exports.config = env.XDG_CONFIG_HOME ||
12 (home ? path.join(home, '.config') : null);
14 exports.cache = env.XDG_CACHE_HOME || (home ? path.join(home, '.cache') : null);
16 exports.runtime = env.XDG_RUNTIME_DIR || null;
18 exports.dataDirs = (env.XDG_DATA_DIRS || '/usr/local/share/:/usr/share/').split(':');
21 exports.dataDirs.unshift(exports.data);
24 exports.configDirs = (env.XDG_CONFIG_DIRS || '/etc/xdg').split(':');
27 exports.configDirs.unshift(exports.config);