Skip to content

Commit

Permalink
Merge pull request #944 from schadomi7/fuzzy-finder-teletype-fix-old-…
Browse files Browse the repository at this point in the history
…nodejs

Fix(fuzzy-finder) fs.lstatSync throws Exception if not a file or dir
  • Loading branch information
confused-Techie authored Mar 16, 2024
2 parents 7d2d876 + 59bdc8d commit 3411fb7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/fuzzy-finder/lib/fuzzy-finder-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,14 @@ module.exports = class FuzzyFinderView {
this.moveToCaretPosition(caretPosition)
} else if (!uri) {
this.cancel()
} else if (fs.lstatSync(uri).isDirectory()) {
this.selectListView.update({errorMessage: 'Selected path is a directory'})
setTimeout(() => { this.selectListView.update({errorMessage: null}) }, 2000)
} else {
try {
if (fs.lstatSync(uri).isDirectory()) {
this.selectListView.update({errorMessage: 'Selected path is a directory'})
setTimeout(() => { this.selectListView.update({errorMessage: null}) }, 2000)
return
}
} catch (e) {}
const caretPosition = this.getCaretPosition()
this.cancel()
this.openURI(uri, caretPosition, openOptions)
Expand Down

0 comments on commit 3411fb7

Please sign in to comment.