From 8b7251ba74f3b2db1feee3c23d54698044badd44 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 7 Apr 2014 04:11:00 -0400 Subject: [PATCH] refactor(dir) fs.lstat -> stat --- lib/server/dir.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/server/dir.js b/lib/server/dir.js index 5034d550..54db8670 100644 --- a/lib/server/dir.js +++ b/lib/server/dir.js @@ -17,12 +17,18 @@ var main = global.cloudcmd.main, fs = main.fs, Util = main.util, - path = main.path; + path = main.path, + /* The lstat() function shall be equivalent to stat(), + except when path refers to a symbolic link. In that case lstat() + shall return information about the link, while stat() shall return + information about the file the link references. + */ + stat = fs.lstat.bind(fs); exports.isDir = function(name, callback) { name += ''; - fs.stat(name, function(error, stat) { + stat(name, function(error, stat) { var isDir; if (!error) @@ -51,13 +57,7 @@ fileCounter = 1; function getDirInfo(dir) { - /* The lstat() function shall be equivalent to stat(), - except when path refers to a symbolic link. In that case lstat() - shall return information about the link, while stat() shall return - information about the file the link references. - */ - - fs.lstat(dir, Util.bind(getStat, dir)); + stat(dir, Util.bind(getStat, dir)); } function getStat(dir, error, stat) {