From a18266c96f4cb7033227fd5ba8f7a8c8d56bb38f Mon Sep 17 00:00:00 2001 From: cinder <> Date: Sun, 21 Apr 2024 23:34:22 -0700 Subject: [PATCH] build.lua: remove some redundant `outdir .. `; move boot.lua into src/ --- build.lua | 15 +++++++++------ boot.lua => src/boot.lua | 0 2 files changed, 9 insertions(+), 6 deletions(-) rename boot.lua => src/boot.lua (100%) 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