Fix open dialog crash when there is a broken link

Fixes #579.
This commit is contained in:
Asher 2019-04-25 15:16:53 -05:00
parent a3ac4567e3
commit 4c5bb83fc1
No known key found for this signature in database
GPG key ID: 7BB4BA9C783D2BBC

View file

@ -404,7 +404,7 @@ class Dialog {
*/
private async list(directory: string): Promise<ReadonlyArray<DialogEntry>> {
const paths = (await util.promisify(fs.readdir)(directory)).sort();
const stats = await Promise.all(paths.map(p => util.promisify(fs.stat)(path.join(directory, p))));
const stats = await Promise.all(paths.map(p => util.promisify(fs.lstat)(path.join(directory, p))));
return stats.map((stat, index): DialogEntry => ({
fullPath: path.join(directory, paths[index]),