Fix signs_lib on Windows.

It seems `io.open' by default opens files as text, which fails
on Windows when the file is a binary file. This prevented
signs_lib from opening the texture files and get the font size,
which resulted in an error.
This commit is contained in:
kaeza 2013-10-24 16:49:36 -02:00
parent eb1ccc3caa
commit b4a16205f3

View File

@ -60,7 +60,7 @@ local function check_random_chars()
for i = 1, 5 do for i = 1, 5 do
local c = math.random(32, 126) local c = math.random(32, 126)
local filename = FONT_FMT:format(TP, c) local filename = FONT_FMT:format(TP, c)
local f = io.open(filename) local f = io.open(filename, "rb")
-- File does not exist (or cannot be read, or ...). -- File does not exist (or cannot be read, or ...).
-- Just assume it's different. -- Just assume it's different.
@ -146,7 +146,7 @@ local function build_char_db()
for c = 32, 126 do for c = 32, 126 do
local filename = FONT_FMT:format(TP, c) local filename = FONT_FMT:format(TP, c)
local f = io.open(filename) local f = io.open(filename, "rb")
if f then if f then
local ch = string.char(c) local ch = string.char(c)
local w, h = read_png_size(f) local w, h = read_png_size(f)