diff --git a/build.lua b/build.lua index 3145b19..cdf2f2f 100644 --- a/build.lua +++ b/build.lua @@ -88,10 +88,12 @@ end local function exportFile(srcpath, dstpath) - if not dstpath then - dstpath = outdir .. srcpath + dstpath = outdir .. (dstpath or srcpath) + if dstpath:sub(-1) == '/' then + dstpath = dstpath .. srcpath end - local srcf = assert(io.open(srcpath)) + srcpath = 'src/' .. srcpath + --load the file to validate syntax, as a very minimal linter do @@ -103,6 +105,7 @@ local function exportFile(srcpath, dstpath) end + local srcf = assert(io.open(srcpath)) local dstf = assert(io.open(dstpath, 'w')) --for now, run a very minimal minifier @@ -159,15 +162,15 @@ fs.makeDirectory(outdir) exportFile('boot.lua') fs.makeDirectory(outdir .. 'core/') -exportFile('src/init.lua', outdir .. 'core/init.lua') +exportFile('init.lua', 'core/') fs.makeDirectory(outdir .. 'core/bin') -exportFile('src/bin/tty.lua', outdir .. 'core/bin/tty.lua') +exportFile('bin/tty.lua', 'core/') fs.makeDirectory(outdir .. 'livedisk/') assert(fs.copy(outdir .. 'core/init.lua', outdir .. 'livedisk/init.lua')) fs.makeDirectory(outdir .. 'livedisk/bin/') assert(fs.copy(outdir .. 'core/bin/tty.lua', outdir .. 'livedisk/bin/tty.lua')) fs.makeDirectory(outdir .. 'livedisk/etc/') -exportFile('src/livedisk/init.lua', outdir .. 'livedisk/etc/init.lua') +exportFile('livedisk/init.lua', 'livedisk/etc/init.lua') -- vi: set ts=2: diff --git a/boot.lua b/src/boot.lua similarity index 100% rename from boot.lua rename to src/boot.lua