From 0d5c98341a596df67f2c7e538d515c8e6b0d4247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCchele?= Date: Tue, 3 Jul 2018 09:54:04 -0700 Subject: [PATCH] allow tilde in pluginPaths Summary: `~` is not supported by node's `fs` functions. So we are replacing it manually. Reviewed By: priteshrnandgaonkar Differential Revision: D8658889 fbshipit-source-id: 36c9885a00a7e07e54ab416d6fda3b29bbda73b6 --- static/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/static/index.js b/static/index.js index 655386be7..ad1286379 100644 --- a/static/index.js +++ b/static/index.js @@ -9,9 +9,10 @@ const path = require('path'); const url = require('url'); const fs = require('fs'); const compilePlugins = require('./compilePlugins.js'); +const os = require('os'); // ensure .sonar folder and config exist -const sonarDir = path.join(require('os').homedir(), '.sonar'); +const sonarDir = path.join(os.homedir(), '.sonar'); if (!fs.existsSync(sonarDir)) { fs.mkdirSync(sonarDir); } @@ -33,6 +34,7 @@ const pluginPaths = config.pluginPaths path.join(__dirname, '..', 'src', 'plugins'), path.join(__dirname, '..', 'src', 'fb', 'plugins'), ) + .map(p => p.replace(/^~/, os.homedir())) .filter(fs.existsSync); process.env.CONFIG = JSON.stringify({