1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-24 06:03:28 +00:00

Remove legacy bHandleRawData check and fix file loading

While the check (most likely) wouldn't break anything, it's better to fix it and not worry then to not fix it and find out it breaks image loading. Also fixes how files are loaded.
This commit is contained in:
MineRobber___T 2017-07-15 18:31:42 -04:00 committed by GitHub
parent 71d024a76c
commit 11060596b1

View File

@ -41,17 +41,17 @@ function loadImage( sPath )
error( "bad argument #1 (expected string, got " .. type( sPath ) .. ")", 2 )
end
if fs.exists( sPath ) and not bLoadRawData then
if fs.exists( sPath ) then
local tImage = {}
local file = io.open( sPath, "r" )
local sLine = file:read()
local sContent = ""
while sLine do
sContent = sContent .. sLine .. "\n"
sContent = sContent .. "\n" .. sLine
sLine = file:read()
end
file:close()
return parseImage( sContent ) -- delegate parsing of images to parseImage function as suggested by @SquidDev in discussion of PR #378
return parseImage( sContent:sub(2) ) -- remove first newline and delegate parsing of images to parseImage function as suggested by @SquidDev in discussion of PR #378
end
return nil
end