Handle empty filesystem correctly
This commit is contained in:
parent
bd0c20af0a
commit
633013648e
|
@ -214,6 +214,11 @@ function ReadTag(buffer, offset) {
|
|||
|
||||
FS.prototype.OnJSONLoaded = function(fs)
|
||||
{
|
||||
if(DEBUG)
|
||||
{
|
||||
console.assert(fs, "Invalid fs passed to OnJSONLoaded");
|
||||
}
|
||||
|
||||
//console.time("parse");
|
||||
var fsroot = JSON.parse(fs)["fsroot"];
|
||||
//console.timeEnd("parse");
|
||||
|
@ -344,19 +349,26 @@ FS.prototype.LoadFile = function(idx) {
|
|||
// return;
|
||||
//}
|
||||
|
||||
LoadBinaryResource(this.baseurl + this.GetFullPath(inode.fid),
|
||||
function(buffer){
|
||||
var data = this.inodedata[idx] = new Uint8Array(buffer);
|
||||
inode.size = data.length; // correct size if the previous was wrong.
|
||||
inode.status = STATUS_OK;
|
||||
//if (inode.name == "rcS") {
|
||||
// this.AppendDateHack(idx);
|
||||
//}
|
||||
this.filesinloadingqueue--;
|
||||
this.HandleEvent(idx);
|
||||
}.bind(this),
|
||||
function(error){throw error;});
|
||||
|
||||
if(this.baseurl)
|
||||
{
|
||||
LoadBinaryResource(this.baseurl + this.GetFullPath(inode.fid),
|
||||
function(buffer){
|
||||
var data = this.inodedata[idx] = new Uint8Array(buffer);
|
||||
inode.size = data.length; // correct size if the previous was wrong.
|
||||
inode.status = STATUS_OK;
|
||||
//if (inode.name == "rcS") {
|
||||
// this.AppendDateHack(idx);
|
||||
//}
|
||||
this.filesinloadingqueue--;
|
||||
this.HandleEvent(idx);
|
||||
}.bind(this),
|
||||
function(error){throw error;});
|
||||
}
|
||||
else
|
||||
{
|
||||
// If baseurl is not set, we started with an empty filesystem. No files
|
||||
// can be loaded
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
|
|
@ -345,7 +345,7 @@ function V86Starter(options)
|
|||
|
||||
setTimeout(function()
|
||||
{
|
||||
if(settings.fs9p)
|
||||
if(settings.fs9p && settings.fs9p_json)
|
||||
{
|
||||
settings.fs9p.OnJSONLoaded(settings.fs9p_json);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue