summaryrefslogtreecommitdiff
path: root/xmake/plugins/plugin/main.lua
diff options
context:
space:
mode:
authorSaikari <[email protected]>2026-07-11 06:12:51 +0300
committerruki <[email protected]>2026-07-30 10:17:31 +0800
commitcb143527bc830df298613ff5a8ff32ee7f6cb9f0 (patch)
tree75cb1c98c61329b93bd361d45ca3b1eb2399655d /xmake/plugins/plugin/main.lua
parent20127575d8f48d9b286021c779bdd85090273c39 (diff)
fix: enhance plugin management with rollback and confirmation features
Diffstat (limited to 'xmake/plugins/plugin/main.lua')
-rw-r--r--xmake/plugins/plugin/main.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmake/plugins/plugin/main.lua b/xmake/plugins/plugin/main.lua
index 4045fb053..e12a433e2 100644
--- a/xmake/plugins/plugin/main.lua
+++ b/xmake/plugins/plugin/main.lua
@@ -201,8 +201,9 @@ end
-- remove the given installed plugin
function _remove()
local name = assert(option.get("plugins"), "please specify the plugin name to be removed!")
- -- avoid escaping the plugins directory, e.g. `xmake plugin --remove ../foo`
- assert(not name:find("..", 1, true) and not name:find("[/\\:]"), "invalid plugin name(%s)!", name)
+ -- avoid escaping the plugins directory, e.g. `xmake plugin --remove ../foo`,
+ -- and `.` or the empty name will be resolved to the plugins directory itself
+ assert(name ~= "" and name ~= "." and not name:find("..", 1, true) and not name:find("[/\\:]"), "invalid plugin name(%s)!", name)
local plugindir = path.join(global.directory(), "plugins", name)
assert(os.isdir(plugindir), "plugin(%s) not found!", name)
os.rmdir(plugindir)