Fix fs.GetFullPath and fs.FindPreviousID forwarding
Use this.GetInode(idx) to get metadata such as filename and size. Use this.inodes to navigate about the filesystem graph
This commit is contained in:
parent
ce0bd6624f
commit
3fcdf62eef
1 changed files with 4 additions and 3 deletions
|
|
@ -715,15 +715,16 @@ FS.prototype.GetFullPath = function(idx) {
|
|||
var path = "";
|
||||
|
||||
while(idx != 0) {
|
||||
path = "/" + this.inodes[idx].name + path;
|
||||
idx = this.inodes[idx].parentid;
|
||||
path = "/" + this.GetInode(idx).name + path;
|
||||
idx = this.GetParent(idx);
|
||||
}
|
||||
return path.substring(1);
|
||||
};
|
||||
|
||||
// no double linked list. So, we need this
|
||||
FS.prototype.FindPreviousID = function(idx) {
|
||||
var inode = this.GetInode(idx);
|
||||
var inode = this.inodes[idx];
|
||||
dbg_assert(this.should_be_linked(inode), "Filesystem FindPreviousID assumes linked inode");
|
||||
var id = this.inodes[inode.parentid].firstid;
|
||||
while(id != -1) {
|
||||
if (this.inodes[id].nextid == idx) return id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue