fix(loader): no need to check plugin.dir in auto_load

This commit is contained in:
Folke Lemaitre 2024-06-24 23:42:51 +02:00
parent 9bcbbc17a7
commit 62a47b921f
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 4 deletions

View File

@ -525,7 +525,7 @@ end
function M.auto_load(modname, modpath) function M.auto_load(modname, modpath)
local plugin = Plugin.find(modpath, { fast = not M.did_handlers }) local plugin = Plugin.find(modpath, { fast = not M.did_handlers })
if plugin and modpath:find(plugin.dir, 1, true) == 1 then if plugin then
plugin._.rtp_loaded = true plugin._.rtp_loaded = true
-- don't load if: -- don't load if:
-- * handlers haven't been setup yet -- * handlers haven't been setup yet

View File

@ -1,5 +1,5 @@
local Config = require("lazy.core.config") local Config = require("lazy.core.config")
local Util = require("lazy.util") local Util = require("lazy.core.util")
local M = {} local M = {}
M.VERSION = 10 M.VERSION = 10
@ -71,9 +71,10 @@ function M.update()
table.sort(ret.pkgs, function(a, b) table.sort(ret.pkgs, function(a, b)
return a.name < b.name return a.name < b.name
end) end)
local code = "return " .. Util.dump(ret) local U = require("lazy.util")
local code = "return " .. U.dump(ret)
vim.fn.mkdir(vim.fn.fnamemodify(Config.options.pkg.cache, ":h"), "p") vim.fn.mkdir(vim.fn.fnamemodify(Config.options.pkg.cache, ":h"), "p")
Util.write_file(Config.options.pkg.cache, code) U.write_file(Config.options.pkg.cache, code)
M.dirty = false M.dirty = false
M.cache = nil M.cache = nil
end end