From fa0cd27cd2752b478cec5da26bdb1565877fdced Mon Sep 17 00:00:00 2001 From: Andrew Koung Date: Tue, 9 Apr 2019 20:51:40 -0400 Subject: [PATCH] lstat_file now calls find_symlink_node --- src/filesystem/implementation.js | 42 +------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/src/filesystem/implementation.js b/src/filesystem/implementation.js index dbb371e..2844265 100644 --- a/src/filesystem/implementation.js +++ b/src/filesystem/implementation.js @@ -943,47 +943,7 @@ function fstat_file(context, ofd, callback) { } function lstat_file(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); - } - } - } + find_symlink_node(context, path, callback); } function link_node(context, oldpath, newpath, callback) {