Lightcord/src/appSettings.ts

21 lines
506 B
TypeScript
Raw Normal View History

2020-05-16 23:24:51 +02:00
import {app} from "electron"
import Settings from "./common/Settings"
import * as fs from "fs"
let settings: Settings
2020-06-27 21:02:48 +02:00
export default Object.assign(getSettings, {
init,
getSettings
}) as typeof getSettings & {init:typeof init, getSettings: typeof getSettings}
export function getSettings(){
2020-05-16 23:24:51 +02:00
if(settings)return settings
2020-06-27 21:02:48 +02:00
init()
return settings
}
export function init(){
2020-05-16 23:24:51 +02:00
fs.mkdirSync(app.getPath("userData"), {recursive: true})
settings = new Settings(app.getPath("userData"))
}