2014-06-29 23:23:03 +00:00
|
|
|
define(function() {
|
|
|
|
|
|
|
|
// The null file is the equivalent of dev/null--you can read/write, but you get nothing
|
|
|
|
// It's used for things like settings files, which can't be saved.
|
|
|
|
|
|
|
|
var NullFile = function(content) {
|
|
|
|
this.content = content;
|
|
|
|
};
|
|
|
|
NullFile.prototype = {
|
2014-09-03 18:27:53 +00:00
|
|
|
virtual: true,
|
2014-06-29 23:23:03 +00:00
|
|
|
open: function(mode, c) {
|
|
|
|
if (typeof mode == "function") {
|
|
|
|
c = mode;
|
|
|
|
}
|
|
|
|
c(null, this);
|
|
|
|
},
|
|
|
|
read: function(c) {
|
|
|
|
c(null, this.content || "");
|
|
|
|
},
|
|
|
|
write: function(data, c) {
|
|
|
|
if (c) c();
|
|
|
|
},
|
|
|
|
stat: function(c) {
|
|
|
|
c("Can't stat a null file");
|
|
|
|
},
|
|
|
|
retain: function() {
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
restore: function(id, c) {
|
|
|
|
c("Can't restore a null file");
|
|
|
|
},
|
|
|
|
getPath: function(c) {
|
|
|
|
c(null, "/dev/null");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
return NullFile;
|
|
|
|
|
|
|
|
});
|