fixed metafile and list bug
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
local fs = require("sys.fs")
|
local fs = require("sys.fs")
|
||||||
local stuff = fs.list("")
|
local stuff = fs.list(syscall.getcwd())
|
||||||
for i,v in ipairs(stuff) do
|
for i,v in ipairs(stuff) do
|
||||||
if fs.isDir(v) then
|
if fs.isDir(v) then
|
||||||
print(v.."/")
|
print(v.."/")
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ function fs.chdir(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function fs.isDir(path)
|
function fs.isDir(path)
|
||||||
return syscall.isDirectory(path)
|
return syscall.type(path) == "directory"
|
||||||
end
|
end
|
||||||
|
|
||||||
return fs
|
return fs
|
||||||
@@ -18,7 +18,7 @@ local function normalizePath(path)
|
|||||||
table.insert(parts, part)
|
table.insert(parts, part)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return "/" .. table.concat(parts, "/") .. (path:sub(-1) == "/" and "/" or "")
|
return "/" .. table.concat(parts, "/")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Resolve mount and disk path
|
-- Resolve mount and disk path
|
||||||
@@ -142,6 +142,9 @@ local function getFileMeta(path)
|
|||||||
if parent ~= "/" then parent = parent .. "/" end
|
if parent ~= "/" then parent = parent .. "/" end
|
||||||
|
|
||||||
local target = parts[i]
|
local target = parts[i]
|
||||||
|
if target == ".meta" then
|
||||||
|
error("Cannot open metafile")
|
||||||
|
end
|
||||||
local metaPath = parent .. ".meta"
|
local metaPath = parent .. ".meta"
|
||||||
|
|
||||||
if disk:fileExists(metaPath) then
|
if disk:fileExists(metaPath) then
|
||||||
@@ -526,5 +529,7 @@ sys["exists"] = vfs.exists
|
|||||||
sys["type"] = vfs.type
|
sys["type"] = vfs.type
|
||||||
sys["mount"] = vfs.mount
|
sys["mount"] = vfs.mount
|
||||||
sys["umount"] = vfs.umount
|
sys["umount"] = vfs.umount
|
||||||
|
sys["getcwd"] = vfs.getcwd
|
||||||
|
sys["chdir"] = vfs.chdir
|
||||||
|
|
||||||
kernel.log("VFS module loaded")
|
kernel.log("VFS module loaded")
|
||||||
Reference in New Issue
Block a user