Merge pull request #3 from MyPasswordIsWeak/master

Fixed discord rpc not working on linux
This commit is contained in:
Oshisaure 2020-10-18 00:12:50 +01:00 committed by GitHub
commit 69a5c0a21a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {