Skip to content

Commit d92fc25

Browse files
author
Akos Kitta
committed
Fixed endless loop in the sketch service.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
1 parent f9a98d7 commit d92fc25

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

arduino-ide-extension/src/node/sketches-service-impl.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@ export class SketchesServiceImpl implements SketchesService {
5252
const uris: string[] = [];
5353
const fsPath = FileUri.fsPath(uri);
5454
const stats = fs.lstatSync(fsPath);
55-
if (stats.isDirectory && await this.isSketchFolder(uri)) {
56-
const fileNames = fs.readdirSync(fsPath);
57-
for (const fileName of fileNames) {
58-
const filePath = path.join(fsPath, fileName);
59-
if (ALLOWED_FILE_EXTENSIONS.indexOf(path.extname(filePath)) !== -1
60-
&& fs.existsSync(filePath)
61-
&& fs.lstatSync(filePath).isFile()) {
62-
uris.push(FileUri.create(filePath).toString())
55+
if (stats.isDirectory) {
56+
if (await this.isSketchFolder(uri)) {
57+
const fileNames = fs.readdirSync(fsPath);
58+
for (const fileName of fileNames) {
59+
const filePath = path.join(fsPath, fileName);
60+
if (ALLOWED_FILE_EXTENSIONS.indexOf(path.extname(filePath)) !== -1
61+
&& fs.existsSync(filePath)
62+
&& fs.lstatSync(filePath).isFile()) {
63+
uris.push(FileUri.create(filePath).toString())
64+
}
6365
}
6466
}
6567
return uris;

0 commit comments

Comments
 (0)