Skip to content

Commit

Permalink
fix: Use $LOCALAPPDATA when loading github token
Browse files Browse the repository at this point in the history
Also use $HOME instead of ~ as its more friendly for expansion on different OS.

Fixes #409

Signed-off-by: Tomas Slusny <[email protected]>
  • Loading branch information
deathbeam committed Sep 16, 2024
1 parent d43fab6 commit 5458a86
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lua/CopilotChat/copilot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,17 @@ local function find_config_path()
local config = vim.fn.expand('$XDG_CONFIG_HOME')
if config and vim.fn.isdirectory(config) > 0 then
return config
elseif vim.fn.has('win32') > 0 then
config = vim.fn.expand('~/AppData/Local')
if vim.fn.isdirectory(config) > 0 then
return config
end
if vim.fn.has('win32') > 0 then
config = vim.fn.expand('$LOCALAPPDATA')
if not config or vim.fn.isdirectory(config) == 0 then
config = vim.fn.expand('$HOME/AppData/Local')
end
else
config = vim.fn.expand('~/.config')
if vim.fn.isdirectory(config) > 0 then
return config
end
config = vim.fn.expand('$HOME/.config')
end
if config and vim.fn.isdirectory(config) > 0 then
return config
end
end

Expand Down

0 comments on commit 5458a86

Please sign in to comment.