Recover from corrupted config.json
Summary: This has caused a few tasks to be raised. We do replace broken configs with a fresh template elsewhere, but we shouldn't throw in this place since we have a fallback. Reviewed By: antonk52 Differential Revision: D51393314 fbshipit-source-id: 8c04946c5b0e74f5f0d42c9492aa381aa608fd35
This commit is contained in:
committed by
Facebook GitHub Bot
parent
877253191d
commit
864e296f35
@@ -30,7 +30,12 @@ export async function getPluginSourceFolders(): Promise<string[]> {
|
||||
const pluginFolders: string[] = [];
|
||||
const flipperConfigPath = path.join(homedir(), '.flipper', 'config.json');
|
||||
if (await fs.pathExists(flipperConfigPath)) {
|
||||
const config = await fs.readJson(flipperConfigPath);
|
||||
let config = {pluginPaths: []};
|
||||
try {
|
||||
config = await fs.readJson(flipperConfigPath);
|
||||
} catch (e) {
|
||||
console.error('Failed to read local flipper config: ', e);
|
||||
}
|
||||
if (config.pluginPaths) {
|
||||
pluginFolders.push(...config.pluginPaths);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user