Fix plugin add command incorrectly resolving path

Fix the plugin add command not storing the resolved path for relative
paths passed to it into plugin-list.json and incorrectly resolving any
path containing ./ or ../ instead of only paths starting with these.
This commit is contained in:
Hornwitser committed 2020-10-23 16:59:20 +02:00
1 parent 1b0b245484
commit 0ae520b5cc
1 file changed
+2 -2
+2 -2
View File
@@ -39,7 +39,7 @@ async function handlePluginCommand(args, pluginList, pluginListPath) {
if (command === "add") {
let pluginPath = args.path;
if (/\.\.?[\/\\]/.test(pluginPath)) {
if (/^\.\.?[\/\\]/.test(pluginPath)) {
pluginPath = path.resolve(pluginPath);
}
@@ -59,7 +59,7 @@ async function handlePluginCommand(args, pluginList, pluginListPath) {
return;
}
pluginList.set(pluginInfo.name, args.path);
pluginList.set(pluginInfo.name, pluginPath);
await fs.outputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
console.log(`Added ${pluginInfo.name}`);