本帖最后由 newone666 于 2021-11-15 11:12 编辑
function string.split(input, delimiter)
input = tostring(input)
delimiter = tostring(delimiter)
if (delimiter=='') then return false end
local pos,arr = 0, {}
for st,sp in function() return string.find(input, delimiter, pos, true) end do
table.insert(arr, string.sub(input, pos, st - 1))
pos = sp + 1
end
table.insert(arr, string.sub(input, pos))
return arr
end
function 创建(路径)
r = exec("ls "..路径)
s = exec("ls -l "..路径)
print(s)
local path = getSdPath().."/文件夹.png"
res = string.split(r, "\n")
function 下一级(i)
ui.dismiss(路径)
print(string.find(s, "-"))
if string.find(s, "-")<=1 then
print(路径)
else
路径 = 路径.."/"..res
创建(路径)
end
end
ui.newLayout(路径,600,1000)
for i=1,#res-1 do
if string.find(s, "-")<=1 then
toast("这个文件的路径是"..路径,0,0,12)
sleep(3000)
exitScript()
end
local id = "文件"..i
--ui.addImageView(路径,"文件"..i,path)
ui.addTextView(路径,"文件"..i,res)
ui.newRow(路径,"row1")
ui.addLine(路径,"lineId1",-1,1)
ui.newRow(路径,"row1")
ui.setOnClick("文件"..i,"下一级("..i..")")
end
--print(路径)
ui.show("layout1")
end
创建("/sdcard")
sleep(100000)
|