mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 08:03:13 +09:00
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:
1 parent
1b0b245484
commit
0ae520b5cc
1 file changed
+2
-2
@@ -39,7 +39,7 @@ async function handlePluginCommand(args, pluginList, pluginListPath) {
|
|||||||
|
|
||||||
if (command === "add") {
|
if (command === "add") {
|
||||||
let pluginPath = args.path;
|
let pluginPath = args.path;
|
||||||
if (/\.\.?[\/\\]/.test(pluginPath)) {
|
if (/^\.\.?[\/\\]/.test(pluginPath)) {
|
||||||
pluginPath = path.resolve(pluginPath);
|
pluginPath = path.resolve(pluginPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ async function handlePluginCommand(args, pluginList, pluginListPath) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginList.set(pluginInfo.name, args.path);
|
pluginList.set(pluginInfo.name, pluginPath);
|
||||||
await fs.outputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
|
await fs.outputFile(pluginListPath, JSON.stringify([...pluginList], null, 4));
|
||||||
console.log(`Added ${pluginInfo.name}`);
|
console.log(`Added ${pluginInfo.name}`);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user