Address #1067: check whether lockfile exists

This commit is contained in:
Stephan Seitz 2021-03-23 17:16:12 +01:00 committed by Stephan Seitz
parent 123d2edfce
commit 88ac3d2365

View file

@ -33,7 +33,8 @@ end
local function get_revision(lang)
if #lockfile == 0 then
lockfile = vim.fn.json_decode(vim.fn.readfile(utils.join_path(utils.get_package_path(), 'lockfile.json')))
local filename = utils.join_path(utils.get_package_path(), 'lockfile.json')
lockfile = vim.fn.filereadable(filename) == 1 and vim.fn.json_decode(vim.fn.readfile(filename)) or {}
end
return (lockfile[lang] and lockfile[lang].revision)
end