ionian/src/setting.ts
2021-02-22 21:58:19 +09:00

16 lines
381 B
TypeScript

import { readFileSync } from 'fs';
export type Setting = {
path: string[]
}
let setting: null|Setting = null;
export const read_setting_from_file = ()=>{
return JSON.parse(readFileSync("settings.json",{encoding:"utf8"})) as Setting;
}
export function get_setting():Setting{
if(setting === null){
setting = read_setting_from_file();
}
return setting;
}