This commit is contained in:
baidwwy 2021-03-16 16:28:04 +08:00
parent d48fdb6ea2
commit ba7fe6b9ad
1 changed files with 40 additions and 7 deletions

View File

@ -1,7 +1,7 @@
--[[
@Author : baidwwy
@Date : 2020-09-22 19:49:01
@LastEditTime : 2021-03-14 22:37:58
@LastEditTime : 2021-03-16 16:27:02
--]]
io.stdout:setvbuf('no',0)
local gge = assert(package.loadlib("ggelua", "luaopen_ggelua"),'\n加载"ggelua.dll"出错')()
@ -59,6 +59,7 @@ if data then
end
local function 处理路径(path)
--相对路径
-- local t = {}
-- for match in path:gmatch("([^/]+)") do
-- if match=='..' then
@ -77,6 +78,13 @@ end
local ,
if gge.isdebug then
function 是否存在(path)
local file<close> = io.open(path,"rb")
if file then
return true
end
end
function 读取文件(path)
local file<close> = io.open(path,'rb');
if file then
@ -84,10 +92,33 @@ if gge.isdebug then
end
end
function 是否存在(path)
local file<close> = io.open(path,"rb")
if file then
return true
function package.dir(path,...)
if select("#", ...)>0 then
path = path:format(...)
end
local lfs = require("lfs")
local dir,u = lfs.dir(path)
local pt = {}
return function ()
repeat
local file = dir(u)
if file then
local f = path..'/'..file
local attr = lfs.attributes (f)
if attr and attr.mode == "directory" then
if file ~= "." and file ~= ".." then
table.insert(pt, f)
end
file = "."
else
return f
end
elseif pt[1] then
path = table.remove(pt, 1)
dir,u = lfs.dir(path)
file = "."
end
until file ~= "."
end
end
else
@ -99,7 +130,10 @@ else
return data[file]
end
function package.dir(path)
function package.dir(path,...)
if select("#", ...)>0 then
path = path:format(...)
end
local k,v
return function ()
repeat
@ -139,4 +173,3 @@ function import(path,env,...)
end
require(entry)
return res