1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-15 07:47:40 +00:00

extended file listing

This commit is contained in:
kepler155c@gmail.com
2017-08-05 04:17:06 -04:00
parent a1660fd073
commit c21afd2875
8 changed files with 34 additions and 47 deletions

View File

@@ -44,25 +44,6 @@ function nativefs.list(node, dir, full)
error('Not a directory')
end
if full then
local t = { }
pcall(function()
for _,f in ipairs(files) do
local fullName = fs.combine(dir, f)
local file = {
name = f,
isDir = fs.isDir(fullName),
isReadOnly = fs.isReadOnly(fullName),
}
if not file.isDir then
file.size = fs.getSize(fullName)
end
table.insert(t, file)
end
end)
return t
end
return files
end
@@ -163,6 +144,32 @@ function fs.complete(partial, dir, includeFiles, includeSlash)
return fs.native.complete(partial, dir, includeFiles, includeSlash)
end
function fs.listEx(dir)
local node = getNode(dir)
if node.fs.listEx then
return node.fs.listEx(node, dir)
end
local t = { }
local files = node.fs.list(node, dir)
pcall(function()
for _,f in ipairs(files) do
local fullName = fs.combine(dir, f)
local file = {
name = f,
isDir = fs.isDir(fullName),
isReadOnly = fs.isReadOnly(fullName),
}
if not file.isDir then
file.size = fs.getSize(fullName)
end
table.insert(t, file)
end
end)
return t
end
function fs.copy(s, t)
local sp = getNode(s)
local tp = getNode(t)