1
0
mirror of https://github.com/jiriks74/presence.nvim synced 2024-11-23 20:37:50 +01:00

Fix sudo error on macOS (#68)

When using sudo a separate environment is used unless specifying sudo -E. This fixes the error of path being nil when using neovim in sudo
This commit is contained in:
Cory Shaw 2022-06-27 16:05:34 -04:00 committed by GitHub
parent 615d4cb8b0
commit 660bd8815e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -365,9 +365,12 @@ function Presence:get_discord_socket_path()
elseif self.os.name == "macos" then
-- Use $TMPDIR for macOS
local path = os.getenv("TMPDIR")
sock_path = path:match("/$")
and path..sock_name
or path.."/"..sock_name
if path then
sock_path = path:match("/$")
and path..sock_name
or path.."/"..sock_name
end
elseif self.os.name == "linux" then
-- Check various temp directory environment variables
local env_vars = {