File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -257,12 +257,21 @@ export abstract class HexUploader<InvokeParamsType> {
257257
258258 resolveHexFilePathEnvs ( input : string , programs : FlashProgramFile [ ] ) : string {
259259
260- const portList = ResManager . GetInstance ( ) . enumSerialPort ( ) ;
260+ let portList : string [ ] = [ ] ;
261+ try {
262+ portList = ResManager . GetInstance ( ) . enumSerialPort ( ) ;
263+ } catch ( error ) {
264+ GlobalEvent . log_error ( error ) ;
265+ }
261266
262267 let commandLine = input
263268 . replace ( / \$ \{ h e x F i l e \} | \$ \{ b i n F i l e \} | \$ \{ p r o g r a m F i l e \} / ig, programs [ 0 ] . path )
264269 . replace ( / \$ \{ p o r t \} / ig, portList [ 0 ] || '' )
265- . replace ( / \$ \{ p o r t L i s t \} / ig, portList . join ( ' ' ) ) ;
270+ . replace ( / \$ \{ p o r t L i s t \} / ig, portList . join ( ' ' ) )
271+ . replace ( '${port[0]}' , portList [ 0 ] || '' )
272+ . replace ( '${port[1]}' , portList [ 1 ] || '' )
273+ . replace ( '${port[2]}' , portList [ 2 ] || '' )
274+ . replace ( '${port[3]}' , portList [ 3 ] || '' ) ;
266275
267276 programs . forEach ( ( file , index ) => {
268277
You can’t perform that action at this time.
0 commit comments