mirror of
https://github.com/neovim/neovim.git
synced 2026-07-17 22:51:20 +00:00
fix(vim.loader): randomized AppImage path pollutes luac cache #36944
different approach to 78bbe53f76
This commit is contained in:
@@ -79,15 +79,7 @@ local function fs_stat_cached(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function normalize(path)
|
local function normalize(path)
|
||||||
path = fs.normalize(path, { expand_env = false, _fast = true })
|
return fs.normalize(path, { expand_env = false, _fast = true })
|
||||||
|
|
||||||
if is_appimage then
|
|
||||||
-- Avoid cache pollution caused by AppImage randomizing the program root. #31165
|
|
||||||
-- "/tmp/.mount_nvimAmpHPH/usr/share/nvim/runtime" => "/usr/share/nvim/runtime"
|
|
||||||
path = path:match('(/usr/.*)') or path
|
|
||||||
end
|
|
||||||
|
|
||||||
return path
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local rtp_cached = {} --- @type string[]
|
local rtp_cached = {} --- @type string[]
|
||||||
@@ -125,6 +117,12 @@ end
|
|||||||
--- @param name string can be a module name, or a file name
|
--- @param name string can be a module name, or a file name
|
||||||
--- @return string file_name
|
--- @return string file_name
|
||||||
local function cache_filename(name)
|
local function cache_filename(name)
|
||||||
|
if is_appimage then
|
||||||
|
-- Avoid cache pollution caused by AppImage randomizing the program root. #31165
|
||||||
|
-- "/tmp/.mount_nvimAmpHPH/usr/share/nvim/runtime" => "/usr/share/nvim/runtime"
|
||||||
|
name = name:match('(/usr/.*)') or name
|
||||||
|
end
|
||||||
|
|
||||||
local ret = ('%s/%s'):format(M.path, uri_encode(name, 'rfc2396'))
|
local ret = ('%s/%s'):format(M.path, uri_encode(name, 'rfc2396'))
|
||||||
return ret:sub(-4) == '.lua' and (ret .. 'c') or (ret .. '.luac')
|
return ret:sub(-4) == '.lua' and (ret .. 'c') or (ret .. '.luac')
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user