compiler update
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
lfs = require "lfs"
|
||||
sourcesPath = "source/"
|
||||
scriptsPath = "scripts/"
|
||||
buildPath = "build/"
|
||||
|
||||
fetchFiles = function(...)
|
||||
local tbl = {}
|
||||
@@ -15,5 +16,27 @@ fetchFiles = function(...)
|
||||
return tbl
|
||||
end
|
||||
|
||||
dirExists = function(path)
|
||||
local _, endIndex = string.find(path, "/")
|
||||
if(endIndex == #path) then
|
||||
path = string.sub(path, 1, #path - 1)
|
||||
end
|
||||
if(lfs.attributes(path, "mode") == "directory") then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local compiledSource = dofile(scriptsPath .. "packager.lua") -- path to packager
|
||||
local compiledSource = dofile(scriptsPath .. "packager.lua") -- path to packager
|
||||
|
||||
if not dirExists(buildPath) then
|
||||
lfs.mkdir(buildPath)
|
||||
assert(dirExists(buildPath), "Failed to make build directory, exiting...")
|
||||
return
|
||||
end
|
||||
|
||||
local sourceFileName = "basalt.lua"
|
||||
local sourceFile = io.open(buildPath .. sourceFileName, "w")
|
||||
|
||||
sourceFile:write(compiledSource)
|
||||
sourceFile:close()
|
||||
Reference in New Issue
Block a user