diff --git a/lib/NodeMCU-Tool.js b/lib/NodeMCU-Tool.js index 4f7f1fb..2ce9d0b 100755 --- a/lib/NodeMCU-Tool.js +++ b/lib/NodeMCU-Tool.js @@ -142,19 +142,20 @@ Tool.upload = function(localFiles, options, onProgess){ // get file stats try{ var fileInfo = _fs.statSync(localFile); + + // check if file is directory + if (fileInfo.isDirectory()) { + _mculogger.error('Path "' + localFile + '" is a directory.'); + onComplete(); + return; + } + // local file available } catch (err){ _logger.error('Local file not found "' + localFile + '" skipping...'); onComplete(); return; } - - // check if file is directory - if (fileInfo.isDirectory()) { - _mculogger.error('Path "' + localFile + '" is a directory.'); - onComplete(); - return; - } // display filename _logger.log('Uploading "' + localFile + '" >> "' + remoteFilename + '"...');