From 43773eb3c4e9e5477076dcc2e314f72bda207c2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 12 Oct 2021 14:02:42 +0800 Subject: update bootstrap --- make/bootstrap.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/make/bootstrap.lua b/make/bootstrap.lua index 021252c5..43dcdf5f 100644 --- a/make/bootstrap.lua +++ b/make/bootstrap.lua @@ -42,12 +42,21 @@ local root; do root = package.cpath:match("([^;]+)"..pattern..pattern..pattern.."$") end -local fs = require "bee.filesystem" +local fs = require 'bee.filesystem' fs.current_path(fs.path(root)) - package.path = table.concat({ - root .. "/script/?.lua", - root .. "/script/?/init.lua", -}, ";") + "script/?.lua", + "script/?/init.lua", +}, ";"):gsub('/', package.config:sub(1,1)) + +loadfile = function (name) + local f, e = io.open(root .. '/' .. name) + if not f then + return false, e + end + local content = f:read 'a' + f:close() + return load(content, '@' .. name) +end assert(loadfile(arg[0]))(table.unpack(arg)) -- cgit v1.2.3