migrated from the depricated .existsSync(..) to .stat(..)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-10-12 02:43:22 +03:00
parent 66634f3316
commit 5618addf35

View File

@ -70,6 +70,8 @@ function(path, make){
var fullpath = false var fullpath = false
var showfiles = true var showfiles = true
var stat = promise.denodeify(fs.stat)
// get the drive list on windows... // get the drive list on windows...
if(os.type() == 'Windows_NT' && path == '/'){ if(os.type() == 'Windows_NT' && path == '/'){
return new promise(function(resolve, reject){ return new promise(function(resolve, reject){
@ -78,18 +80,22 @@ function(path, make){
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
.split('') .split('')
.forEach(function(drive){ .forEach(function(drive){
// XXX error handling??? stat(drive+':/')
if(fs.existsSync(drive+':/')){ // XXX
make(drive+':/') .catch(function(err){
} })
.then(function(data){
data && make(drive+':/')
if(drive == 'Z'){
resolve()
}
})
}) })
resolve()
}) })
// list dirs... // list dirs...
} else { } else {
var stat = promise.denodeify(fs.stat)
return new promise(function(resolve, reject){ return new promise(function(resolve, reject){
fs.readdir(path, function(err, files){ fs.readdir(path, function(err, files){
// XXX // XXX