tabby/app/lib/config.ts

14 lines
366 B
TypeScript
Raw Normal View History

2018-10-07 02:50:06 +08:00
import * as fs from 'fs'
import * as path from 'path'
import * as yaml from 'js-yaml'
import { app } from 'electron'
export function loadConfig (): any {
2020-12-24 21:03:14 +08:00
const configPath = path.join(app.getPath('userData'), 'config.yaml')
2018-10-07 02:50:06 +08:00
if (fs.existsSync(configPath)) {
2021-01-29 04:52:11 +08:00
return yaml.load(fs.readFileSync(configPath, 'utf8'))
2018-10-07 02:50:06 +08:00
} else {
return {}
}
}