From 0536c6e552fa3abc974cb5c15eb81a587fc03eb4 Mon Sep 17 00:00:00 2001 From: hat0uma <55551571+hat0uma@users.noreply.github.com> Date: Sun, 5 Jan 2025 21:45:25 +0900 Subject: [PATCH] fix(copilot): Prioritize `xdg_config` for OAuth token references on Windows (#1037) --- lua/avante/providers/copilot.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lua/avante/providers/copilot.lua b/lua/avante/providers/copilot.lua index 197cff2..bfdbeb6 100644 --- a/lua/avante/providers/copilot.lua +++ b/lua/avante/providers/copilot.lua @@ -104,8 +104,10 @@ H.get_oauth_token = function() ---@type string local config_dir - if vim.tbl_contains({ "linux", "darwin" }, os_name) then - config_dir = (xdg_config and vim.fn.isdirectory(xdg_config) > 0) and xdg_config or vim.fn.expand("~/.config") + if xdg_config and vim.fn.isdirectory(xdg_config) > 0 then + config_dir = xdg_config + elseif vim.tbl_contains({ "linux", "darwin" }, os_name) then + config_dir = vim.fn.expand("~/.config") else config_dir = vim.fn.expand("~/AppData/Local") end