diff options
| author | ruki <[email protected]> | 2026-08-15 16:29:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-08-15 16:29:16 +0800 |
| commit | 67ffcd8a481a5c6c51da8044bfe1ebed980b1e56 (patch) | |
| tree | 28054248eb7e151102330994b45ce1087ee8905d /xmake/core/package/addon.lua | |
| parent | 62bae6f061c8577aae7dff8c1f6c47a5e705f3bb (diff) | |
fix some bugs
Diffstat (limited to 'xmake/core/package/addon.lua')
| -rw-r--r-- | xmake/core/package/addon.lua | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/xmake/core/package/addon.lua b/xmake/core/package/addon.lua index 43cb81edf..15786c62f 100644 --- a/xmake/core/package/addon.lua +++ b/xmake/core/package/addon.lua @@ -770,53 +770,5 @@ function addon.reload() addon._GLOBALMODULES = nil end --- rescan the install directory and rebuild the registry --- --- it's only used to repair the registry file, e.g. the user removed some addon directories manually --- -function addon.rescan() - local oldregistry = addon._registry() - local registry = {} - for _, versiondir in ipairs(os.dirs(path.join(addon.installdir(), "*", "*"))) do - local payloads = addon.payloads_of(versiondir) - if #payloads > 0 then - local dirname = path.filename(path.directory(versiondir)) - local version = path.filename(versiondir) - local oldentry = oldregistry[dirname] - local oldaddoninfo = oldentry and oldentry.versions and oldentry.versions[version] - local description, deps - if oldaddoninfo then - -- we need to keep them, we cannot get them from the installed payloads - description = oldaddoninfo.description - deps = oldaddoninfo.deps - end - -- but the packages also install their own manifest, we can reuse it - local name - local manifestfile = path.join(versiondir, "manifest.txt") - if os.isfile(manifestfile) then - local manifest = io.load(manifestfile) - if manifest then - name = manifest.name ~= dirname and manifest.name or nil - description = manifest.description or description - end - end - local entry = registry[dirname] - if entry == nil then - entry = {versions = {}} - registry[dirname] = entry - end - entry.versions[version] = {version = version, name = name or (oldaddoninfo and oldaddoninfo.name), - description = description, deps = deps, payloads = payloads, - plugins = addon._plugins_of(versiondir), templates = addon._templates_of(versiondir)} - -- we keep the active version if it's still installed, otherwise we use the last one - if entry.active == nil or (oldentry and oldentry.active == version) then - entry.active = version - end - end - end - addon._save(registry) - return addon.addons() -end - -- return module return addon |
