From d946b17e135db809858bd2ab43cf1b6eeefb3c65 Mon Sep 17 00:00:00 2001 From: Oshisaure Date: Sun, 18 Oct 2020 00:40:14 +0100 Subject: [PATCH] Minor change on PR #3 to use the error handling that was already implemented --- libs/discordRPC.lua | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/libs/discordRPC.lua b/libs/discordRPC.lua index 7e4e8d3..1b9f5e4 100644 --- a/libs/discordRPC.lua +++ b/libs/discordRPC.lua @@ -2,20 +2,18 @@ local ffi = require "ffi" -- Get the host os to load correct lib -local os = love.system.getOS() +local osname = 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") +if osname == "Linux" then + discordRPClib = ffi.load(love.filesystem.getSource().."/libs/discord-rpc.so") +elseif osname == "OS X" then + discordRPClib = ffi.load(love.filesystem.getSource().."/libs/discord-rpc.dylib") +elseif osname == "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") + -- Else it crashes later on + error(string.format("Discord rpc not supported on platform (%s)", osname)) end