Added Windows batch files for automated packaging of fused Windows packages.

They require the tar utility, but that's included in the latest versions of Windows 10. The utility is available for installation on other versions of Windows.

I also found out how to get the Discord RPC library to load with all ways of running the game, but that required changing libs/discordRPC.lua. Binary libraries can only be loaded from the filesystem, outside of a .love archive or fused executable.
This commit is contained in:
Brandon McGriff
2020-11-09 15:51:00 -08:00
parent 2279c24d11
commit 6a295cad59
5 changed files with 57 additions and 6 deletions

View File

@@ -5,12 +5,22 @@ local ffi = require "ffi"
local osname = love.system.getOS()
local discordRPClib = nil
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")
-- FFI requires the libraries really be files just sitting in the filesystem. It
-- can't load libraries from a .love archive, nor a fused executable on Windows.
-- Merely using love.filesystem.getSource() only works when running LOVE with
-- the game unarchived from command line, like "love .".
--
-- The code here setting "source" will set the directory where the game was run
-- from, so FFI can load discordRPC. We assume that the discordRPC library's
-- libs directory is in the same directory as the .love archive; if it's
-- missing, it just won't load.
local source = love.filesystem.getSource()
if string.sub(source, -5) == ".love" or love.filesystem.isFused() then
source = love.filesystem.getSourceBaseDirectory()
end
if osname == "Linux" or osname == "OS X" or osname == "Windows" then
discordRPClib = ffi.load(source.."/libs/discord-rpc")
else
-- Else it crashes later on
error(string.format("Discord rpc not supported on platform (%s)", osname))