File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -457,10 +457,16 @@ function addLaunchJsonIfNecessary(generator: AssetGenerator, operations: Operati
457457 let launchJson : string = generator . createLaunchJson ( isWebProject ) ;
458458
459459 if ( existingLaunchConfigs ) {
460- launchJson = launchJson . substring ( 0 , launchJson . length - 1 ) ;
461460 let existingLaunchConfigsString = JSON . stringify ( existingLaunchConfigs , null , ' ' ) ;
462- existingLaunchConfigsString = existingLaunchConfigsString . substring ( 1 , existingLaunchConfigsString . length - 1 ) ;
463- launchJson = `${ launchJson } ,${ existingLaunchConfigsString } ]` ;
461+ const lastBracket = launchJson . lastIndexOf ( ']' ) ;
462+ const lastBracketInExistingConfig = existingLaunchConfigsString . lastIndexOf ( ']' ) ;
463+ const firstBracketInExistingConfig = existingLaunchConfigsString . lastIndexOf ( '[' ) ;
464+
465+ if ( lastBracket !== - 1 && lastBracketInExistingConfig !== - 1 && firstBracketInExistingConfig !== - 1 ) {
466+ launchJson = launchJson . substring ( 0 , lastBracket ) ;
467+ existingLaunchConfigsString = existingLaunchConfigsString . substring ( firstBracketInExistingConfig , lastBracketInExistingConfig ) ;
468+ launchJson = `${ launchJson } ,${ existingLaunchConfigsString } ]` ;
469+ }
464470 }
465471
466472 const configurationsMassaged : string = indentJsonString ( launchJson ) ;
You can’t perform that action at this time.
0 commit comments