Refactor using new filesystem function

This commit is contained in:
Fabian 2018-10-08 16:34:12 -03:00
parent 3f79814e05
commit af0f153640

View file

@ -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);
}
});
}
);
}
}; };
/** /**