Skip to content

Commit

Permalink
[chore] Log SDL loading error (#827)
Browse files Browse the repository at this point in the history
Make any future problems similar to koreader/koreader#4627 show up in the log.
  • Loading branch information
Frenzie committed Feb 21, 2019
1 parent 83c1287 commit 4f753f1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ffi/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -439,16 +439,24 @@ local haveSDL1 = nil
local haveSDL2 = nil

function util.haveSDL1()
local err
if haveSDL1 == nil then
haveSDL1 = pcall(ffi.load, "SDL")
haveSDL1, err = pcall(ffi.load, "SDL")
end
if not haveSDL1 then
print("SDL not loaded:", err)
end
return haveSDL1
end

--- Returns true if SDL2
function util.haveSDL2()
local err
if haveSDL2 == nil then
haveSDL2 = pcall(ffi.load, "SDL2")
haveSDL2, err = pcall(ffi.load, "SDL2")
end
if not haveSDL2 then
print("SDL2 not loaded:", err)
end
return haveSDL2
end
Expand Down

0 comments on commit 4f753f1

Please sign in to comment.