diff options
| author | Shmerl <shtetldik+shmerl@gmail.com> | 2025-12-14 13:46:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-14 13:46:53 -0500 |
| commit | 1363ef7d50bbaf6988f81cf757a6c731f6e4cf07 (patch) | |
| tree | d96b172bca61494290b550ece6fd6bcd90352772 /runtime/lua/vim/loader.lua | |
| parent | 8c7023b7b3c29ab3d4ae585a6bcbb4298587ceee (diff) | |
| download | rneovim-1363ef7d50bbaf6988f81cf757a6c731f6e4cf07.tar.gz rneovim-1363ef7d50bbaf6988f81cf757a6c731f6e4cf07.tar.bz2 rneovim-1363ef7d50bbaf6988f81cf757a6c731f6e4cf07.zip | |
fix(vim.loader): randomized AppImage path pollutes luac cache #36944
different approach to 78bbe53f7615e8b38d5289d9ce0579996109579b
Diffstat (limited to 'runtime/lua/vim/loader.lua')
| -rw-r--r-- | runtime/lua/vim/loader.lua | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/runtime/lua/vim/loader.lua b/runtime/lua/vim/loader.lua index d2513c5d8f..585f65617f 100644 --- a/runtime/lua/vim/loader.lua +++ b/runtime/lua/vim/loader.lua @@ -79,15 +79,7 @@ local function fs_stat_cached(path) end local function normalize(path) - path = 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 + return fs.normalize(path, { expand_env = false, _fast = true }) end local rtp_cached = {} --- @type string[] @@ -125,6 +117,12 @@ end --- @param name string can be a module name, or a file name --- @return string file_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')) return ret:sub(-4) == '.lua' and (ret .. 'c') or (ret .. '.luac') end |