Make files and folders

This commit is contained in:
bingus_violet 2024-07-13 05:58:44 -05:00
parent 9ece56849d
commit fe0e222417

View file

@ -12,6 +12,10 @@ var paths = {
urls: path.join(__dirname, "data/urls.json") urls: path.join(__dirname, "data/urls.json")
} }
if (!fs.existsSync(paths.data)) {
fs.mkdirSync(paths.data)
}
module.exports = { module.exports = {
paths, paths,
config: undefined, config: undefined,
@ -47,6 +51,10 @@ module.exports = {
} }
} }
if (!fs.existsSync(paths.config)) {
fs.writeFileSync(paths.config, "{}")
}
var currentConfig = JSON.parse(fs.readFileSync(paths.config)) var currentConfig = JSON.parse(fs.readFileSync(paths.config))
var defaultConfig = JSON.parse(fs.readFileSync(paths.defaultConfig)) var defaultConfig = JSON.parse(fs.readFileSync(paths.defaultConfig))
currentConfig = Object.assign({}, defaultConfig, currentConfig) currentConfig = Object.assign({}, defaultConfig, currentConfig)