Chargement/Sauvegarde profil via l'UI
This commit is contained in:
@ -10,7 +10,7 @@ var Cache = require('./cache');
|
||||
* @param filePath The path of the json file
|
||||
* @return Promise
|
||||
*/
|
||||
exports.loadJSONFile = function(filePath) {
|
||||
exports.loadJSON = function(filePath) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
fs.readFile(filePath, 'utf8', function(err, fileContent) {
|
||||
if(err) return reject(err);
|
||||
@ -24,6 +24,19 @@ exports.loadJSONFile = function(filePath) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.saveJSON = function(filePath, obj) {
|
||||
|
||||
var jsonStr = JSON.stringify(obj, null, 2);
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
fs.writeFile(filePath, jsonStr, function(err) {
|
||||
if(err) return reject(err);
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Load a INI file
|
||||
*
|
||||
@ -44,7 +57,18 @@ exports.loadINIFile = function(filePath) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.runApp = function(execPath) {
|
||||
exports.clearFreeDesktopFlags = function(exec) {
|
||||
return exec.replace(/%[uUdDfFnNickvm]/g, '');
|
||||
};
|
||||
|
||||
exports.runApp = function(execPath, opts) {
|
||||
|
||||
opts = opts || {};
|
||||
|
||||
if(opts.clearFreeDesktopFlags) {
|
||||
execPath = exports.clearFreeDesktopFlags(execPath);
|
||||
}
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
cp.exec(execPath, function(err) {
|
||||
if(err) return reject(err);
|
||||
|
Reference in New Issue
Block a user