1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 02:06:29 +00:00
Files
Boostnote/browser/main/lib/RcParser.js
2017-08-10 09:44:00 +09:00

25 lines
588 B
JavaScript

import path from 'path'
import sander from 'sander'
function parse () {
const BOOSTNOTERC = '.boostnoterc'
const homePath = global.process.env.HOME || global.process.env.USERPROFILE
const boostnotercPath = path.join(homePath, BOOSTNOTERC)
if (!sander.existsSync(boostnotercPath)) return {}
return JSON.parse(sander.readFileSync(boostnotercPath).toString())
}
function exec (boostnotercPath) {
const config = this.parse(boostnotercPath)
if (config.execs === undefined) return
_.forEach(config.execs, (exec) => {
eval(exec)
})
}
export default {
parse,
exec
}