Set properties

This commit is contained in:
Raymond Feng 2013-06-25 10:44:37 -07:00
parent 14af972336
commit ceeb14e620
3 changed files with 13 additions and 5 deletions

View File

@ -8,5 +8,9 @@ var Container = exports.Container = function Container(client, details) {
util.inherits(Container, base.Container);
Container.prototype._setProperties = function(details) {
for(var k in details) {
if(typeof details[k] !== 'function') {
this[k] = details[k];
}
}
}

View File

@ -8,5 +8,9 @@ var File = exports.File = function File(client, details) {
util.inherits(File, base.File);
File.prototype._setProperties = function(details) {
for(var k in details) {
if(typeof details[k] !== 'function') {
this[k] = details[k];
}
}
}

View File

@ -177,15 +177,15 @@ FileSystemProvider.prototype.getFile = function (container, file, cb) {
if (!validateName(file, cb)) return;
var filePath = path.join(this.root, container, file);
fs.stat(filePath, function (err, stat) {
var file = null;
var f = null;
if (!err) {
var props = {container: container, name: file};
for (var p in stat) {
props[p] = stat[p];
}
file = new File(self, props);
f = new File(self, props);
}
cb && cb(err, file);
cb && cb(err, f);
});
}