1
0
Fork 0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-12-29 19:32:05 +01:00

fix(Flatpak): clear sock_path if the flatpak socket wasn't found

This commit is contained in:
Jiří Štefka 2023-09-25 22:11:48 +02:00
parent ff8442c168
commit 0601dd513e
Signed by: jiriks74
GPG key ID: 1D5E30D3DB2264DE

View file

@ -397,6 +397,8 @@ function Presence:get_discord_socket_path()
xdg_path = xdg_path and xdg_path:match("/$") and xdg_path.."app/com.discordapp.Discord" or xdg_path.."/app/com.discordapp.Discord" xdg_path = xdg_path and xdg_path:match("/$") and xdg_path.."app/com.discordapp.Discord" or xdg_path.."/app/com.discordapp.Discord"
self.log:debug(string.format("Using XDG runtime path: %s", xdg_path)) self.log:debug(string.format("Using XDG runtime path: %s", xdg_path))
sock_path = xdg_path:match("/$") and xdg_path..sock_name or xdg_path.."/"..sock_name sock_path = xdg_path:match("/$") and xdg_path..sock_name or xdg_path.."/"..sock_name
-- Check if the socket path exists and if not set it to nil
sock_path = vim.fn.filereadable(sock_path) == 1 and sock_path or nil
end end
-- If the socket path is still nil, check other temp directories -- If the socket path is still nil, check other temp directories