diff options
| author | ruki <[email protected]> | 2026-08-08 23:17:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-09 18:28:59 +0800 |
| commit | cf62f410738a7489fe052d183bcf616ecf5f7067 (patch) | |
| tree | ea9d09e1d05c3a392e9f08688618a1a9663625b3 /xmake/core | |
| parent | 8564ea66201d1398cb8ee5b91efc784a379c4a64 (diff) | |
add addon search
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/package/addon.lua | 19 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/package/addon.lua | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/xmake/core/package/addon.lua b/xmake/core/package/addon.lua index d433bdf8a..78830d266 100644 --- a/xmake/core/package/addon.lua +++ b/xmake/core/package/addon.lua @@ -182,6 +182,25 @@ function addon.register(name, version, opt) addon._save(addons) end +-- remove the given installed addon +-- +-- @param name the addon name +-- @return true or false and errors +-- +function addon.remove(name) + local dirname = addon.dirname(name) + local installdir = path.join(addon.installdir(), dirname) + if not os.isdir(installdir) then + return false, string.format("addon(%s) not found!", name) + end + local ok, errors = os.rm(installdir) + if not ok then + return false, errors + end + addon.unregister(name) + return true +end + -- unregister the given addon function addon.unregister(name) local dirname = addon.dirname(name) diff --git a/xmake/core/sandbox/modules/import/core/package/addon.lua b/xmake/core/sandbox/modules/import/core/package/addon.lua index ecbd95f2b..2885bd45f 100644 --- a/xmake/core/sandbox/modules/import/core/package/addon.lua +++ b/xmake/core/sandbox/modules/import/core/package/addon.lua @@ -36,6 +36,7 @@ sandbox_core_package_addon.addons = addon.addons sandbox_core_package_addon.addondir = addon.addondir sandbox_core_package_addon.register = addon.register sandbox_core_package_addon.unregister = addon.unregister +sandbox_core_package_addon.remove = addon.remove sandbox_core_package_addon.rescan = addon.rescan sandbox_core_package_addon.clear = addon.clear |
