Set properties
This commit is contained in:
parent
14af972336
commit
ceeb14e620
|
@ -8,5 +8,9 @@ var Container = exports.Container = function Container(client, details) {
|
||||||
util.inherits(Container, base.Container);
|
util.inherits(Container, base.Container);
|
||||||
|
|
||||||
Container.prototype._setProperties = function(details) {
|
Container.prototype._setProperties = function(details) {
|
||||||
|
for(var k in details) {
|
||||||
|
if(typeof details[k] !== 'function') {
|
||||||
|
this[k] = details[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -8,5 +8,9 @@ var File = exports.File = function File(client, details) {
|
||||||
util.inherits(File, base.File);
|
util.inherits(File, base.File);
|
||||||
|
|
||||||
File.prototype._setProperties = function(details) {
|
File.prototype._setProperties = function(details) {
|
||||||
|
for(var k in details) {
|
||||||
|
if(typeof details[k] !== 'function') {
|
||||||
|
this[k] = details[k];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -177,15 +177,15 @@ FileSystemProvider.prototype.getFile = function (container, file, cb) {
|
||||||
if (!validateName(file, cb)) return;
|
if (!validateName(file, cb)) return;
|
||||||
var filePath = path.join(this.root, container, file);
|
var filePath = path.join(this.root, container, file);
|
||||||
fs.stat(filePath, function (err, stat) {
|
fs.stat(filePath, function (err, stat) {
|
||||||
var file = null;
|
var f = null;
|
||||||
if (!err) {
|
if (!err) {
|
||||||
var props = {container: container, name: file};
|
var props = {container: container, name: file};
|
||||||
for (var p in stat) {
|
for (var p in stat) {
|
||||||
props[p] = stat[p];
|
props[p] = stat[p];
|
||||||
}
|
}
|
||||||
file = new File(self, props);
|
f = new File(self, props);
|
||||||
}
|
}
|
||||||
cb && cb(err, file);
|
cb && cb(err, f);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue