Merge pull request #16 from wasubu/fix/windows-dir-safety

Improve Windows support and add error message for nil directory in live-server.nvim
This commit is contained in:
Barrett Ruth 2025-05-24 00:05:35 -05:00 committed by GitHub
commit 75cd33beec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -10,16 +10,18 @@ end
local job_cache = {}
local function find_cached_dir(dir)
local cur = dir
if not dir then
vim.notify("live-server.nvim: No directory provided to find_cached_dir()", vim.log.levels.ERROR)
return
end
local cur = dir
while not job_cache[cur] do
if cur == '/' or string.match(cur, '^[A-Z]:\\$') then
return
end
cur = vim.fn.fnamemodify(cur, ':h')
end
return cur
end