Fixed font loading on Linux

This commit is contained in:
Wofsauge committed 2020-11-29 01:18:33 +01:00
1 parent 182ec1e56a
commit 8a8f7d75db
1 file changed
+6 -13
+6 -13
View File
@@ -55,15 +55,15 @@ local nullVector = Vector(0,0)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
------------------------------- Load Font --------------------------------- ------------------------------- Load Font ---------------------------------
local isWindows, _ = pcall(require,"LinuxDetectionFile")
local isluadebug, os = pcall(require,"os") local isluadebug, os = pcall(require,"os")
local modfolder ='external item descriptions_836319872' --release mod folder name
if isWindows then
-- WINDOWS
if isluadebug then if isluadebug then
local modfolder ='external item descriptions_836319872' --release mod folder name
local userPath = os.tmpname() local userPath = os.tmpname()
userPath = string.gsub(userPath, "\\", "/") userPath = string.gsub(userPath, "\\", "/")
local newPath = "" local newPath = ""
if not string.find(userPath, "AppData") then
EID.modPath = os.getenv("HOME") .. "/.local/share/binding of isaac afterbirth+ mods/"..modfolder.."/"
else
for str in string.gmatch(userPath, "([^/]+)") do for str in string.gmatch(userPath, "([^/]+)") do
if str ~="AppData" then if str ~="AppData" then
newPath = newPath..str.."/" newPath = newPath..str.."/"
@@ -72,6 +72,7 @@ if isWindows then
end end
end end
EID.modPath = newPath.."Documents/My Games/Binding of Isaac Afterbirth+ Mods/"..modfolder.."/" EID.modPath = newPath.."Documents/My Games/Binding of Isaac Afterbirth+ Mods/"..modfolder.."/"
end
else else
--use some very hacky trickery to get the path to this mod --use some very hacky trickery to get the path to this mod
local _, err = pcall(require, "") local _, err = pcall(require, "")
@@ -81,16 +82,8 @@ if isWindows then
EID.modPath = string.sub(err, modPathStart + 1, modPathEnd - 1) EID.modPath = string.sub(err, modPathStart + 1, modPathEnd - 1)
end end
EID.modPath = string.gsub(EID.modPath, "\\", "/") EID.modPath = string.gsub(EID.modPath, "\\", "/")
EID.modPath = string.gsub(EID.modPath, "//", "/")
EID.modPath = string.gsub(EID.modPath, ":/", ":\\") EID.modPath = string.gsub(EID.modPath, ":/", ":\\")
else
-- LINUX - Special thanks to jerb for providing these!
if isluadebug then
EID.modPath = os.getenv("HOME") .. "/.local/share/binding of isaac afterbirth+ mods/"..modfolder.."/"
else
-- only work if installed in the default location
EID.modPath = "../../../../../.local/share/binding of isaac afterbirth+ mods/"..modfolder.."/"
end
end
EID.font = Font() -- init font object EID.font = Font() -- init font object
local fontFile = EID.Config["FontType"] or "default" local fontFile = EID.Config["FontType"] or "default"