fix remaining lint errors
This commit is contained in:
parent
c590f930e5
commit
638109f911
34
src/fs.js
34
src/fs.js
|
@ -121,7 +121,6 @@ define(function(require) {
|
||||||
var name = basename(path);
|
var name = basename(path);
|
||||||
var parentPath = dirname(path);
|
var parentPath = dirname(path);
|
||||||
|
|
||||||
if(ROOT_DIRECTORY_NAME == name) {
|
|
||||||
function check_root_directory_node(error, rootDirectoryNode) {
|
function check_root_directory_node(error, rootDirectoryNode) {
|
||||||
if(error) {
|
if(error) {
|
||||||
callback(error);
|
callback(error);
|
||||||
|
@ -132,14 +131,12 @@ define(function(require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
read_object(objectStore, ROOT_NODE_ID, check_root_directory_node);
|
|
||||||
} else {
|
|
||||||
// in: parent directory node
|
// in: parent directory node
|
||||||
// out: parent directory data
|
// out: parent directory data
|
||||||
function read_parent_directory_data(error, parentDirectoryNode) {
|
function read_parent_directory_data(error, parentDirectoryNode) {
|
||||||
if(error) {
|
if(error) {
|
||||||
callback(error);
|
callback(error);
|
||||||
} else if(!_(parentDirectoryNode).has('data') || !parentDirectoryNode.type == MODE_DIRECTORY) {
|
} else if(!(_(parentDirectoryNode).has('data') && parentDirectoryNode.type == MODE_DIRECTORY)) {
|
||||||
callback(new ENotDirectory('a component of the path prefix is not a directory'));
|
callback(new ENotDirectory('a component of the path prefix is not a directory'));
|
||||||
} else {
|
} else {
|
||||||
read_object(objectStore, parentDirectoryNode.data, get_node_id_from_parent_directory_data);
|
read_object(objectStore, parentDirectoryNode.data, get_node_id_from_parent_directory_data);
|
||||||
|
@ -161,6 +158,9 @@ define(function(require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ROOT_DIRECTORY_NAME == name) {
|
||||||
|
read_object(objectStore, ROOT_NODE_ID, check_root_directory_node);
|
||||||
|
} else {
|
||||||
find_node(objectStore, parentPath, read_parent_directory_data);
|
find_node(objectStore, parentPath, read_parent_directory_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1374,6 +1374,19 @@ define(function(require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_descriptor_position(error, stats) {
|
||||||
|
if(error) {
|
||||||
|
deferred.reject(error);
|
||||||
|
} else {
|
||||||
|
if(stats.size + offset < 0) {
|
||||||
|
deferred.reject(new EInvalid('resulting file offset would be negative'));
|
||||||
|
} else {
|
||||||
|
ofd.position = stats.size + offset;
|
||||||
|
deferred.resolve(ofd.position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var ofd = that.openFiles[fd];
|
var ofd = that.openFiles[fd];
|
||||||
|
|
||||||
if(!ofd) {
|
if(!ofd) {
|
||||||
|
@ -1398,19 +1411,6 @@ define(function(require) {
|
||||||
var transaction = that.db.transaction([FILE_STORE_NAME], IDB_RW);
|
var transaction = that.db.transaction([FILE_STORE_NAME], IDB_RW);
|
||||||
var files = transaction.objectStore(FILE_STORE_NAME);
|
var files = transaction.objectStore(FILE_STORE_NAME);
|
||||||
|
|
||||||
function update_descriptor_position(error, stats) {
|
|
||||||
if(error) {
|
|
||||||
deferred.reject(error);
|
|
||||||
} else {
|
|
||||||
if(stats.size + offset < 0) {
|
|
||||||
deferred.reject(new EInvalid('resulting file offset would be negative'));
|
|
||||||
} else {
|
|
||||||
ofd.position = stats.size + offset;
|
|
||||||
deferred.resolve(ofd.position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fstat_file(files, ofd, update_descriptor_position);
|
fstat_file(files, ofd, update_descriptor_position);
|
||||||
} else {
|
} else {
|
||||||
deferred.reject(new EInvalid('whence argument is not a proper value'));
|
deferred.reject(new EInvalid('whence argument is not a proper value'));
|
||||||
|
|
Loading…
Reference in New Issue