This repository was archived by the owner on Oct 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,32 @@ export async function activate(context: vscode.ExtensionContext) {
152
152
return { board : arduinoContextModule . default . boardManager . currentBoard . name } ;
153
153
} ) ;
154
154
155
+ const getChildArduinoSources = ( directory : string ) => {
156
+ if ( ! directory ) {
157
+ directory = vscode . workspace . rootPath ;
158
+ }
159
+
160
+ let sourcesArray = [ ] ;
161
+ const list = fs . readdirSync ( directory ) ;
162
+
163
+ list . forEach ( function ( file ) {
164
+ if ( file . startsWith ( '.' ) ) {
165
+ return ;
166
+ }
167
+ file = `${ directory } \\${ file } ` ;
168
+ const stat = fs . statSync ( file ) ;
169
+ if ( stat && stat . isDirectory ( ) ) {
170
+ sourcesArray = sourcesArray . concat ( getChildArduinoSources ( file ) ) ;
171
+ } else {
172
+ if ( / \. ( ( i n o ) | ( c p p ) | c ) $ / . test ( file . trim ( ) ) ) {
173
+ sourcesArray . push ( file . slice ( vscode . workspace . rootPath . length + 1 ) ) ;
174
+ }
175
+ }
176
+ } ) ;
177
+
178
+ return sourcesArray ;
179
+ }
180
+
155
181
registerArduinoCommand ( "arduino.setSketchFile" , async ( ) => {
156
182
const sketchFileName = deviceContext . sketch ;
157
183
const newSketchFileName = await vscode . window . showInputBox ( {
You can’t perform that action at this time.
0 commit comments