config.ts 368 B

12345678910111213
  1. import * as fs from 'fs'
  2. import * as path from 'path'
  3. import * as yaml from 'js-yaml'
  4. import { app } from 'electron'
  5. export function loadConfig (): any {
  6. let configPath = path.join(app.getPath('userData'), 'config.yaml')
  7. if (fs.existsSync(configPath)) {
  8. return yaml.safeLoad(fs.readFileSync(configPath, 'utf8'))
  9. } else {
  10. return {}
  11. }
  12. }