From 2a678f03e8178ba5981387c67802e0f08bcbaaea Mon Sep 17 00:00:00 2001 From: Andrew Kwon Date: Thu, 29 Apr 2021 17:30:03 -0700 Subject: [PATCH] Fix invalid XDG runtime dir socket path --- lua/presence/init.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/presence/init.lua b/lua/presence/init.lua index 099af33..6f46d97 100644 --- a/lua/presence/init.lua +++ b/lua/presence/init.lua @@ -94,11 +94,16 @@ function Presence:setup(options) self:set_option("client_id", "793271441293967371") self:set_option("debounce_timeout", 15) + local discord_socket = self:get_discord_socket() + if not discord_socket then + self.log:error("Failed to get Discord IPC socket") + end + -- Initialize discord RPC client self.discord = Discord:init({ logger = self.log, client_id = options.client_id, - ipc_socket = self:get_discord_socket(), + ipc_socket = discord_socket, }) -- Seed instance id using unique socket address @@ -273,7 +278,7 @@ function Presence:get_discord_socket() local var = env_vars[i] local path = vim.loop.os_getenv(var) if path then - return path..sock_name + return path:match("/$") and path..sock_name or path.."/"..sock_name end end