From 6d817f149e9f41bb7cd90878f38e4488f9b21fc8 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 3 Aug 2024 09:28:59 +0000 Subject: [PATCH] api/load-from-fs: refactor loadFile, use in loadJSON --- api/src/misc/load-from-fs.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/api/src/misc/load-from-fs.js b/api/src/misc/load-from-fs.js index 25ae23bf..f91a20cb 100644 --- a/api/src/misc/load-from-fs.js +++ b/api/src/misc/load-from-fs.js @@ -9,16 +9,12 @@ const root = join( export function loadJSON(path) { try { - return JSON.parse(fs.readFileSync(join(root, path), 'utf-8')) + return JSON.parse(loadFile(path)) } catch { return false } } export function loadFile(path) { - try { - return fs.readFileSync(path, 'utf-8') - } catch { - return false - } + return fs.readFileSync(join(root, path), 'utf-8') }