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;
}
var path_infos = fs.SearchPath(file);
var id = path_infos.id;
if(id === -1)
{
callback(new FileNotFoundError(), null);
}
else
{
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);
}
});
}
);
}
fs.read_file(file).then((result) => {
if(result)
{
callback(null, result);
}
else
{
callback(new FileNotFoundError(), null);
}
});
};
/**