Skip to content

Commit

Permalink
Merge pull request #20 from sakisds/master
Browse files Browse the repository at this point in the history
Fix crashing when trying to upload a folder
  • Loading branch information
Andi Dittrich authored Nov 30, 2016
2 parents 5f1b4e7 + 1a4fccf commit 709ecd7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/NodeMCU-Tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,19 @@ Tool.upload = function(localFiles, options, onProgess){
// get file stats
try{
var fileInfo = _fs.statSync(localFile);

// local file available
}catch (err){
} 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 + '"...');
Expand Down

0 comments on commit 709ecd7

Please sign in to comment.