mirror of
https://github.com/LunarVim/LunarVim.git
synced 2025-08-28 05:54:03 +02:00
bugfix: Ensure lvim table is valid before calling Log:warn() (#1742)
Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
This commit is contained in:
parent
3dc24cd0c3
commit
5deb0e57ce
2 changed files with 8 additions and 16 deletions
|
@ -109,13 +109,7 @@ function M:init()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
require("lvim.config"):init {
|
require("lvim.config"):init()
|
||||||
config_dir = self.config_dir,
|
|
||||||
}
|
|
||||||
local config = require "lvim.config"
|
|
||||||
config:init {
|
|
||||||
user_config = join_paths(self.config_dir, "config.lua"),
|
|
||||||
}
|
|
||||||
|
|
||||||
require("lvim.plugin-loader"):init {
|
require("lvim.plugin-loader"):init {
|
||||||
package_root = self.pack_dir,
|
package_root = self.pack_dir,
|
||||||
|
|
|
@ -2,17 +2,11 @@ local utils = require "lvim.utils"
|
||||||
local Log = require "lvim.core.log"
|
local Log = require "lvim.core.log"
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local user_config_dir = get_config_dir()
|
local user_config_dir = get_config_dir()
|
||||||
local user_config_file = utils.join_paths(user_config_dir, "config.lua")
|
local user_config_file = utils.join_paths(user_config_dir, "config.lua")
|
||||||
|
|
||||||
-- Fallback config.lua to lv-config.lua
|
---Get the full path to the user configuration file
|
||||||
if not utils.is_file(user_config_file) then
|
---@return string
|
||||||
local lv_config = utils.join_paths(user_config_dir, "lv-config.lua")
|
|
||||||
Log:warn(string.format("[%s] not found, falling back to [%s]", user_config_file, lv_config))
|
|
||||||
user_config_file = lv_config
|
|
||||||
end
|
|
||||||
|
|
||||||
function M:get_user_config_path()
|
function M:get_user_config_path()
|
||||||
return user_config_file
|
return user_config_file
|
||||||
end
|
end
|
||||||
|
@ -160,7 +154,11 @@ function M:load(config_path)
|
||||||
config_path = config_path or self.get_user_config_path()
|
config_path = config_path or self.get_user_config_path()
|
||||||
local ok, _ = pcall(dofile, config_path)
|
local ok, _ = pcall(dofile, config_path)
|
||||||
if not ok then
|
if not ok then
|
||||||
Log:warn("Invalid configuration: " .. config_path)
|
if utils.is_file(user_config_file) then
|
||||||
|
Log:warn("Invalid configuration: " .. config_path)
|
||||||
|
else
|
||||||
|
Log:warn(string.format("Unable to find configuration file [%s]", config_path))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
deprecation_notice()
|
deprecation_notice()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue