Add utility.getGlobalDirectory method

This commit is contained in:
Mohammad Fares
2018-10-01 12:28:39 +03:00
parent bbd2ff0c20
commit 0cbeafb026

View File

@@ -190,6 +190,20 @@ function changeYAMLValue(data, key, value) {
} }
/**
* Get the path of the global data directory
*
* - For Windows, get the path of APPDATA
* - For Linux and MacOS, get the path of the home directory
*
* @return {String}
*/
function getGlobalDirectory() {
return di.path.join(process.env.APPDATA || process.env.HOME, '.terminalizer');
}
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// Module ////////////////////////////////////////// // Module //////////////////////////////////////////
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
@@ -199,5 +213,6 @@ module.exports = {
loadJSON: loadJSON, loadJSON: loadJSON,
resolveFilePath: resolveFilePath, resolveFilePath: resolveFilePath,
getDefaultConfig: getDefaultConfig, getDefaultConfig: getDefaultConfig,
changeYAMLValue: changeYAMLValue changeYAMLValue: changeYAMLValue,
getGlobalDirectory: getGlobalDirectory
}; };