Refactor using new filesystem function
This commit is contained in:
parent
3f79814e05
commit
af0f153640
|
@ -1145,35 +1145,16 @@ V86Starter.prototype.read_file = function(file, callback)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var path_infos = fs.SearchPath(file);
|
fs.read_file(file).then((result) => {
|
||||||
var id = path_infos.id;
|
if(result)
|
||||||
|
{
|
||||||
if(id === -1)
|
callback(null, result);
|
||||||
{
|
}
|
||||||
callback(new FileNotFoundError(), null);
|
else
|
||||||
}
|
{
|
||||||
else
|
callback(new FileNotFoundError(), null);
|
||||||
{
|
}
|
||||||
fs.OpenInode(id, undefined);
|
});
|
||||||
fs.AddEvent(
|
|
||||||
id,
|
|
||||||
function()
|
|
||||||
{
|
|
||||||
const size = fs.GetInode(id).size;
|
|
||||||
fs.Read(id, 0, size).then(data =>
|
|
||||||
{
|
|
||||||
if(data)
|
|
||||||
{
|
|
||||||
callback(null, data);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
callback(new FileNotFoundError(), null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue