This commit is contained in:
Alan K 2014-07-21 15:28:26 -04:00
parent ef4de22586
commit 79e9008175
4 changed files with 25 additions and 19 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "filer", "name": "filer",
"version": "0.0.19", "version": "0.0.20",
"main": "dist/filer.js", "main": "dist/filer.js",
"devDependencies": { "devDependencies": {
"mocha": "1.17.1", "mocha": "1.17.1",

28
dist/filer.js vendored
View File

@ -12519,17 +12519,21 @@ function set_extended_attribute (context, path_or_fd, name, value, flag, callbac
} }
/** /**
* make_root_directory * ensure_root_directory. Creates a root node if necessary.
*
* Note: this should only be invoked when formatting a new file system.
* Multiple invocations of this by separate instances will still result
* in only a single super node.
*/ */
// Note: this should only be invoked when formatting a new file system function ensure_root_directory(context, callback) {
function make_root_directory(context, callback) {
var superNode; var superNode;
var directoryNode; var directoryNode;
var directoryData; var directoryData;
function write_super_node(error, existingNode) { function ensure_super_node(error, existingNode) {
if(!error && existingNode) { if(!error && existingNode) {
callback(new Errors.EEXIST()); // Another instance has beat us and already created the super node.
callback();
} else if(error && !(error instanceof Errors.ENOENT)) { } else if(error && !(error instanceof Errors.ENOENT)) {
callback(error); callback(error);
} else { } else {
@ -12569,7 +12573,7 @@ function make_root_directory(context, callback) {
} }
} }
context.get(SUPER_NODE_ID, write_super_node); context.get(SUPER_NODE_ID, ensure_super_node);
} }
/** /**
@ -14211,7 +14215,7 @@ function ftruncate(fs, context, fd, length, callback) {
} }
module.exports = { module.exports = {
makeRootDirectory: make_root_directory, ensureRootDirectory: ensure_root_directory,
open: open, open: open,
close: close, close: close,
mknod: mknod, mknod: mknod,
@ -14493,7 +14497,7 @@ function FileSystem(options, callback) {
complete(err); complete(err);
return; return;
} }
impl.makeRootDirectory(context, complete); impl.ensureRootDirectory(context, complete);
}); });
}); });
} }
@ -15114,7 +15118,9 @@ module.exports = IndexedDB;
}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) }).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"../constants.js":44,"../errors.js":47}],57:[function(_dereq_,module,exports){ },{"../constants.js":44,"../errors.js":47}],57:[function(_dereq_,module,exports){
var FILE_SYSTEM_NAME = _dereq_('../constants.js').FILE_SYSTEM_NAME; var FILE_SYSTEM_NAME = _dereq_('../constants.js').FILE_SYSTEM_NAME;
var asyncCallback = _dereq_('../../lib/async.js').nextTick; // NOTE: prefer setImmediate to nextTick for proper recursion yielding.
// see https://github.com/js-platform/filer/pull/24
var asyncCallback = _dereq_('../../lib/async.js').setImmediate;
/** /**
* Make shared in-memory DBs possible when using the same name. * Make shared in-memory DBs possible when using the same name.
@ -15690,7 +15696,7 @@ Shell.prototype.ls = function(dir, options, callback) {
}); });
} }
async.each(entries, getDirEntry, function(error) { async.eachSeries(entries, getDirEntry, function(error) {
callback(error, result); callback(error, result);
}); });
}); });
@ -15758,7 +15764,7 @@ Shell.prototype.rm = function(path, options, callback) {
// Root dir entries absolutely // Root dir entries absolutely
return Path.join(pathname, filename); return Path.join(pathname, filename);
}); });
async.each(entries, remove, function(error) { async.eachSeries(entries, remove, function(error) {
if(error) { if(error) {
callback(error); callback(error);
return; return;

12
dist/filer.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@
"idb", "idb",
"websql" "websql"
], ],
"version": "0.0.19", "version": "0.0.20",
"author": "Alan K <ack@modeswitch.org> (http://blog.modeswitch.org)", "author": "Alan K <ack@modeswitch.org> (http://blog.modeswitch.org)",
"homepage": "http://js-platform.github.io/filer", "homepage": "http://js-platform.github.io/filer",
"bugs": "https://github.com/js-platform/filer/issues", "bugs": "https://github.com/js-platform/filer/issues",