made request review changes
This commit is contained in:
parent
9d1a76756d
commit
b5914f78af
|
@ -279,12 +279,52 @@ function find_node(context, path, callback) {
|
|||
}
|
||||
|
||||
/**
|
||||
* find_lnode
|
||||
* find_symlink_node
|
||||
*/
|
||||
// in: file or directory path
|
||||
// out: node structure, or error
|
||||
function find_symbolic_node(context, path, callback) {
|
||||
lstat_file(context, path, callback);
|
||||
// out: symlink node structure, or error
|
||||
function find_symlink_node(context, path, callback) {
|
||||
path = normalize(path);
|
||||
var name = basename(path);
|
||||
var parentPath = dirname(path);
|
||||
|
||||
var directoryNode;
|
||||
var directoryData;
|
||||
|
||||
if(ROOT_DIRECTORY_NAME === name) {
|
||||
find_node(context, path, callback);
|
||||
} else {
|
||||
find_node(context, parentPath, read_directory_data);
|
||||
}
|
||||
|
||||
function read_directory_data(error, result) {
|
||||
if(error) {
|
||||
callback(error);
|
||||
} else {
|
||||
directoryNode = result;
|
||||
context.getObject(directoryNode.data, check_if_file_exists);
|
||||
}
|
||||
}
|
||||
|
||||
function create_node(error, data) {
|
||||
if(error) {
|
||||
return callback(error);
|
||||
}
|
||||
Node.create(data, callback);
|
||||
}
|
||||
|
||||
function check_if_file_exists(error, result) {
|
||||
if(error) {
|
||||
callback(error);
|
||||
} else {
|
||||
directoryData = result;
|
||||
if(!directoryData.hasOwnProperty(name)) {
|
||||
callback(new Errors.ENOENT('a component of the path does not name an existing file', path));
|
||||
} else {
|
||||
context.getObject(directoryData[name].id, create_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2078,7 +2118,7 @@ function lchown_file(context, path, uid, gid, callback) {
|
|||
update_node_times(context, path, node, { mtime: Date.now() }, callback);
|
||||
}
|
||||
}
|
||||
find_symbolic_node(context, path, update_owner);
|
||||
find_symlink_node(context, path, update_owner);
|
||||
}
|
||||
|
||||
function getxattr(context, path, name, callback) {
|
||||
|
|
|
@ -341,7 +341,6 @@ function FileSystem(options, callback) {
|
|||
{ name: 'futimes' },
|
||||
{ name: 'getxattr', promises: true, absPathArgs: [0] },
|
||||
{ name: 'lchown' },
|
||||
// lchmod - https://github.com/filerjs/filer/issues/619
|
||||
{ name: 'link', promises: true, absPathArgs: [0, 1] },
|
||||
{ name: 'lseek' },
|
||||
{ name: 'lstat', promises: true },
|
||||
|
|
Loading…
Reference in New Issue