From 3f0d26ef525cc81da24d55706fb079fa5a97b56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 9 Feb 2022 19:05:58 +0800 Subject: cleanup --- make/bootstrap.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'make/bootstrap.lua') diff --git a/make/bootstrap.lua b/make/bootstrap.lua index 3d2ce465..42de853a 100644 --- a/make/bootstrap.lua +++ b/make/bootstrap.lua @@ -35,7 +35,8 @@ if main then end end -local root; do +local root +do if main then local fs = require 'bee.filesystem' local mainPath = fs.path(arg[0]) @@ -44,21 +45,21 @@ local root; do root = '.' end else - local sep = package.config:sub(1,1) + local sep = package.config:sub(1, 1) if sep == '\\' then sep = '/\\' end - local pattern = "["..sep.."]+[^"..sep.."]+" - root = package.cpath:match("([^;]+)"..pattern..pattern.."$") - arg[0] = root .. package.config:sub(1,1) .. 'main.lua' + local pattern = "[" .. sep .. "]+[^" .. sep .. "]+" + root = package.cpath:match("([^;]+)" .. pattern .. pattern .. "$") + arg[0] = root .. package.config:sub(1, 1) .. 'main.lua' end - root = root:gsub('[/\\]', package.config:sub(1,1)) + root = root:gsub('[/\\]', package.config:sub(1, 1)) end package.path = table.concat({ root .. "/script/?.lua", root .. "/script/?/init.lua", -}, ";"):gsub('/', package.config:sub(1,1)) +}, ";"):gsub('/', package.config:sub(1, 1)) package.searchers[2] = function (name) local filename, err = package.searchpath(name, package.path) -- cgit v1.2.3