implement some leftover stuff in rtfs
This commit is contained in:
parent
fccd0d4983
commit
afbf6eaa7a
@ -183,7 +183,6 @@ end
|
|||||||
function proxy:dumpIndex()
|
function proxy:dumpIndex()
|
||||||
print(" # ty init len end name")
|
print(" # ty init len end name")
|
||||||
for i, tp, st, sl, n in self:allIEntries() do
|
for i, tp, st, sl, n in self:allIEntries() do
|
||||||
-- print(string.format("%2x %2x %4x %4x %4x %s",i,tp,st,sl,st+sl-1, n))
|
|
||||||
print(string.format("%2i %2i %4i %4i %4i %s",i,tp,st,sl,st+sl-1, n))
|
print(string.format("%2i %2i %4i %4i %4i %s",i,tp,st,sl,st+sl-1, n))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -266,9 +265,7 @@ function proxy:relocateFile(n,dest,loud)
|
|||||||
-- modify any writing handles to write to the destination before doing anything
|
-- modify any writing handles to write to the destination before doing anything
|
||||||
local realLen
|
local realLen
|
||||||
for k,v in pairs(self.handles) do
|
for k,v in pairs(self.handles) do
|
||||||
print(n, v.ft[1])
|
|
||||||
if v.ft[1] == n and (v.w or v.a) then
|
if v.ft[1] == n and (v.w or v.a) then
|
||||||
print("found file handle")
|
|
||||||
v.ft[2] = dest
|
v.ft[2] = dest
|
||||||
realLen = v.currentSector
|
realLen = v.currentSector
|
||||||
end
|
end
|
||||||
@ -434,7 +431,7 @@ function rtfs.mount(d)
|
|||||||
end
|
end
|
||||||
function p.isDirectory(name)
|
function p.isDirectory(name)
|
||||||
name = fnormalize(name)
|
name = fnormalize(name)
|
||||||
return p:findIEntry(ftypes.directory, nil, nil, name) ~= nil
|
return name == "" and true or p:findIEntry(ftypes.directory, nil, nil, name) ~= nil
|
||||||
end
|
end
|
||||||
function p.size(name)
|
function p.size(name)
|
||||||
name = fnormalize(name)
|
name = fnormalize(name)
|
||||||
@ -472,6 +469,11 @@ function rtfs.mount(d)
|
|||||||
function p.makeDirectory(name)
|
function p.makeDirectory(name)
|
||||||
name = fnormalize(name)
|
name = fnormalize(name)
|
||||||
if #name < 1 or p:findIEntry(nil,nil,nil,name) then return false end
|
if #name < 1 or p:findIEntry(nil,nil,nil,name) then return false end
|
||||||
|
local seg = fs.segments(name)
|
||||||
|
for j = 1, #seg-1 do
|
||||||
|
p.makeDirectory(table.concat(seg, "/", 1, j))
|
||||||
|
end
|
||||||
|
if not p.isDirectory(table.concat(seg,"/",1,#seg-1)) then return false end
|
||||||
local ni = p:nextEntry()
|
local ni = p:nextEntry()
|
||||||
p:writeIEntry(ni, ftypes.directory, 0, 0, name)
|
p:writeIEntry(ni, ftypes.directory, 0, 0, name)
|
||||||
p:setISize(math.max(p.isize, ni))
|
p:setISize(math.max(p.isize, ni))
|
||||||
@ -486,7 +488,10 @@ function rtfs.mount(d)
|
|||||||
end
|
end
|
||||||
local fi, ft = p:findIEntry(ftypes.directory, nil, nil, name)
|
local fi, ft = p:findIEntry(ftypes.directory, nil, nil, name)
|
||||||
if fi then
|
if fi then
|
||||||
error("removing dirs not implemented")
|
for _,f in ipairs(p.list(name)) do
|
||||||
|
p.remove(name.."/"..f)
|
||||||
|
end
|
||||||
|
p:writeIEntry(fi, ftypes.unused, 0, 0, "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function p.rename(from, to)
|
function p.rename(from, to)
|
||||||
|
Loading…
Reference in New Issue
Block a user