Fixed rpc not working on linux

This commit is contained in:
MyPasswordIsWeak 2020-10-17 21:11:38 +02:00
parent 8c62f321a0
commit 54f4b0b890
2 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,23 @@
local ffi = require "ffi"
local discordRPClib = ffi.load(love.filesystem.getSource().."/libs/discord-rpc")
-- Get the host os to load correct lib
local os = love.system.getOS()
local discordRPClib = nil
if os == 'Linux' then
discordRPClib = ffi.load(love.filesystem.getSource().."/libs/discord-rpc.so")
elseif os == 'OS X' then
discordRPClib = ffi.load(love.filesystem.getSource().."/libs/discord-rpc.dylib")
elseif os == 'Windows' then
discordRPClib = ffi.load(love.filesystem.getSource().."/libs/discord-rpc.dll")
else
-- Else it crashes later on
discordRPClib = ffi.load(love.filesystem.getSource().."/libs/discord-rpc.e")
print('Discord rpc not supported on platform')
end
ffi.cdef[[
typedef struct DiscordRichPresence {