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:
parent
615d4cb8b0
commit
660bd8815e
@ -365,9 +365,12 @@ function Presence:get_discord_socket_path()
|
|||||||
elseif self.os.name == "macos" then
|
elseif self.os.name == "macos" then
|
||||||
-- Use $TMPDIR for macOS
|
-- Use $TMPDIR for macOS
|
||||||
local path = os.getenv("TMPDIR")
|
local path = os.getenv("TMPDIR")
|
||||||
sock_path = path:match("/$")
|
|
||||||
and path..sock_name
|
if path then
|
||||||
or path.."/"..sock_name
|
sock_path = path:match("/$")
|
||||||
|
and path..sock_name
|
||||||
|
or path.."/"..sock_name
|
||||||
|
end
|
||||||
elseif self.os.name == "linux" then
|
elseif self.os.name == "linux" then
|
||||||
-- Check various temp directory environment variables
|
-- Check various temp directory environment variables
|
||||||
local env_vars = {
|
local env_vars = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user