Skip to content

Commit

Permalink
fix: Ignore invalid file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dominik-schwabe committed Jun 30, 2022
1 parent 541115e commit e366fce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lua/project_nvim/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function M.on_buf_enter()
end

local current_dir = vim.fn.expand("%:p:h", true)
if path.is_excluded(current_dir) then
if not path.exists(current_dir) or path.is_excluded(current_dir) then
return
end

Expand Down
4 changes: 4 additions & 0 deletions lua/project_nvim/utils/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ function M.is_excluded(dir)
return false
end

function M.exists(path)
return vim.fn.empty(vim.fn.glob(path)) == 0
end

return M

0 comments on commit e366fce

Please sign in to comment.