|
|
|
@ -23,7 +23,7 @@ function startup()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FileSystem.prototype.getattr = function(path) {
|
|
|
|
|
entry = this.getEntry(path);
|
|
|
|
|
var entry = this.getEntry(path);
|
|
|
|
|
if (entry) {
|
|
|
|
|
return {
|
|
|
|
|
mode: entry.mode || 0755,
|
|
|
|
@ -39,6 +39,25 @@ function startup()
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FileSystem.prototype.readdir = function(path) {
|
|
|
|
|
var result, entry, subdir, i, len;
|
|
|
|
|
|
|
|
|
|
entry = this.getEntry(path);
|
|
|
|
|
if ((entry) && (entry.type == "dir")) {
|
|
|
|
|
result = [".", ".."];
|
|
|
|
|
for(subdir in entry.entries) {
|
|
|
|
|
if (entry.entries.hasOwnProperty(subdir)) {
|
|
|
|
|
result.push(subdir);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result = FileSystem.BAD_NO_ENTRY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var fs = new FileSystem({
|
|
|
|
|
mode: 0755,
|
|
|
|
|
type: "dir",
|
|
|
|
@ -70,6 +89,9 @@ function startup()
|
|
|
|
|
case "getattr":
|
|
|
|
|
result = fs.getattr(request.params[0]);
|
|
|
|
|
break;
|
|
|
|
|
case "readdir":
|
|
|
|
|
result = fs.readdir(request.params[0]);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|