mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-07 04:36:33 +00:00
Fixed endless loop in the sketch service.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
f9a98d708e
commit
d92fc25769
@ -52,14 +52,16 @@ export class SketchesServiceImpl implements SketchesService {
|
||||
const uris: string[] = [];
|
||||
const fsPath = FileUri.fsPath(uri);
|
||||
const stats = fs.lstatSync(fsPath);
|
||||
if (stats.isDirectory && await this.isSketchFolder(uri)) {
|
||||
const fileNames = fs.readdirSync(fsPath);
|
||||
for (const fileName of fileNames) {
|
||||
const filePath = path.join(fsPath, fileName);
|
||||
if (ALLOWED_FILE_EXTENSIONS.indexOf(path.extname(filePath)) !== -1
|
||||
&& fs.existsSync(filePath)
|
||||
&& fs.lstatSync(filePath).isFile()) {
|
||||
uris.push(FileUri.create(filePath).toString())
|
||||
if (stats.isDirectory) {
|
||||
if (await this.isSketchFolder(uri)) {
|
||||
const fileNames = fs.readdirSync(fsPath);
|
||||
for (const fileName of fileNames) {
|
||||
const filePath = path.join(fsPath, fileName);
|
||||
if (ALLOWED_FILE_EXTENSIONS.indexOf(path.extname(filePath)) !== -1
|
||||
&& fs.existsSync(filePath)
|
||||
&& fs.lstatSync(filePath).isFile()) {
|
||||
uris.push(FileUri.create(filePath).toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
return uris;
|
||||
|
Loading…
x
Reference in New Issue
Block a user