2
0
mirror of https://github.com/frappe/books.git synced 2024-12-24 11:55:46 +00:00
books/electron/settings.js

27 lines
565 B
JavaScript
Raw Normal View History

2018-04-16 13:03:54 +00:00
const os = require('os');
2018-04-18 06:47:00 +00:00
const path = require('path');
2018-04-16 13:03:54 +00:00
const { writeFile } = require('frappejs/server/utils');
const homedir = os.homedir();
const configFilePath = path.join(homedir, '.config', 'frappe-accounting', 'settings.json');
function getSettings() {
let settings;
try {
settings = require(configFilePath);
} catch (e) {
settings = {}
}
return settings;
}
async function saveSettings(settings) {
await writeFile(configFilePath, JSON.stringify(settings));
}
module.exports = {
getSettings,
saveSettings
}