From d92306bde393b30ca6346d402ff84913112549fe Mon Sep 17 00:00:00 2001 From: wasubu Date: Fri, 23 May 2025 12:59:03 +0900 Subject: [PATCH] Improve Windows support and add error message for nil dir --- lua/live-server.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/live-server.lua b/lua/live-server.lua index 43d21f2..aab08d2 100644 --- a/lua/live-server.lua +++ b/lua/live-server.lua @@ -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