mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-10-26 11:08:40 +03:00
Fix fs.lstatSync throws Exception if no file or dir
If it throws the Exception, other valid uris such as atom://teletype/... will not be evaluated in the else branch The old fs-plus did not throw. Newer versions of fs.lstatSync allow for option parameter to control if it throws.
This commit is contained in:
parent
4c6d9071c2
commit
59bdc8d354
@ -166,10 +166,14 @@ module.exports = class FuzzyFinderView {
|
|||||||
this.moveToCaretPosition(caretPosition)
|
this.moveToCaretPosition(caretPosition)
|
||||||
} else if (!uri) {
|
} else if (!uri) {
|
||||||
this.cancel()
|
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 {
|
} 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()
|
const caretPosition = this.getCaretPosition()
|
||||||
this.cancel()
|
this.cancel()
|
||||||
this.openURI(uri, caretPosition, openOptions)
|
this.openURI(uri, caretPosition, openOptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user