From 67f25439be5280745fa09a3c7be1b468f7c81554 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 19 Jun 2014 09:13:28 -0400 Subject: [PATCH] refactor(dir) rm main --- lib/server/dir.js | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/server/dir.js b/lib/server/dir.js index 841dd2cd..eb1cc991 100644 --- a/lib/server/dir.js +++ b/lib/server/dir.js @@ -2,28 +2,31 @@ (function(){ 'use strict'; - if(!global.cloudcmd) - return console.log( - '# dir.js' + '\n' + - '# -----------' + '\n' + - '# Module is part of Cloud Commander,' + '\n' + - '# used for getting dir size.' + '\n' + - '# If you wont to see at work' + '\n' + - '# try GET /api/v1/fs/etc?size or' + '\n' + - '# dir.getSize(\'/etc, function(err, size) {' + '\n' + - '# });' + '\n' + - '# http://cloudcmd.io' + '\n'); + + + /* + '# dir.js' + '\n' + + '# -----------' + '\n' + + '# Module is part of Cloud Commander,' + '\n' + + '# used for getting dir size.' + '\n' + + '# If you wont to see at work' + '\n' + + '# try GET /api/v1/fs/etc?size or' + '\n' + + '# dir.getSize(\'/etc, function(err, size) {' + '\n' + + '# });' + '\n' + + '# http://cloudcmd.io' + '\n'); + */ - var main = global.cloudcmd.main, - fs = main.fs, - Util = main.util, - path = main.path, + var fs = require('fs'), + path = require('path'), + + Util = require('../util'), + /* 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); + stat = fs.lstat; exports.isDir = function(name, callback) { name += '';