Fixed file handle bug
Now it should work on CraftOS PC without any errors
This commit is contained in:
@@ -465,7 +465,7 @@ local function writeNewPackage(subdir, name, path)
|
|||||||
if not(fs.isDir(path))then
|
if not(fs.isDir(path))then
|
||||||
outputFile:write("project['"..subdir.."']['"..name.."'] = ".."function(...)")
|
outputFile:write("project['"..subdir.."']['"..name.."'] = ".."function(...)")
|
||||||
local file = io.open(path, "r")
|
local file = io.open(path, "r")
|
||||||
local fileData file:read("*all")
|
local fileData = file:read("*all")
|
||||||
if(minifyProject)then
|
if(minifyProject)then
|
||||||
local success, data = minify(fileData)
|
local success, data = minify(fileData)
|
||||||
if(success)then
|
if(success)then
|
||||||
@@ -476,7 +476,7 @@ local function writeNewPackage(subdir, name, path)
|
|||||||
else
|
else
|
||||||
outputFile:write(fileData:gsub("]]", "] ]"):gsub("]]", "] ]").."\n")
|
outputFile:write(fileData:gsub("]]", "] ]"):gsub("]]", "] ]").."\n")
|
||||||
end
|
end
|
||||||
file.close()
|
file:close()
|
||||||
outputFile:write("end; \n")
|
outputFile:write("end; \n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -491,16 +491,17 @@ for _,v in pairs(projectFiles)do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local main = io.open(fs.combine(projectPath, mainFile), "r"):read("*all")
|
local main = io.open(fs.combine(projectPath, mainFile), "r")
|
||||||
|
local mainData = main:read("*all")
|
||||||
if(minifyProject)then
|
if(minifyProject)then
|
||||||
local success,data = minify(main)
|
local success,data = minify(mainData)
|
||||||
if(success)then
|
if(success)then
|
||||||
outputFile:write(data)
|
outputFile:write(data)
|
||||||
else
|
else
|
||||||
print("Error: Can't minify "..fs.combine(projectPath, mainFile))
|
print("Error: Can't minify "..fs.combine(projectPath, mainFile).." "..data)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
outputFile:write(main)
|
outputFile:write(mainData)
|
||||||
end
|
end
|
||||||
|
main:close()
|
||||||
outputFile:close()
|
outputFile:close()
|
||||||
|
|||||||
Reference in New Issue
Block a user