Fix B3D & PNG reading on Windows

master
Lars Mueller 2022-05-12 14:26:21 +02:00
parent b7cd469284
commit 25961ad87e
2 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ return setmetatable({}, {__index = function(self, filename)
if filename == "character.b3d" and minetest.sha1(modlib.file.read(path)) == bad_character_b3d_hash then
path = fixed_character_b3d_path
end
local model = io.open(path, "r")
local model = io.open(path, "rb")
local character = assert(modlib.b3d.read(model))
assert(not model:read(1))
model:close()

View File

@ -1,7 +1,7 @@
local media_paths = modlib.minetest.media.paths
return setmetatable({}, {__index = function(self, texture_name)
local file = io.open(media_paths[texture_name], "r")
local file = io.open(media_paths[texture_name], "rb")
local png = modlib.minetest.decode_png(file)
assert(not file:read(1), "EOF expected")
file:close()