@@ -492,7 +492,7 @@ async function preStartup(context: vscode.ExtensionContext) {
492492 return true ;
493493 }
494494
495- async function checkProgram ( configName : string , defaultPath : string , name : string , installFunc : ( env : NodeJS . ProcessEnv ) => Thenable < boolean | undefined > , btn : string , outdatedCheck ?: ( log : string ) => ( boolean | [ boolean , string ] ) ) : Promise < boolean | undefined > {
495+ async function checkProgram ( forced : boolean , configName : string , defaultPath : string , name : string , installFunc : ( env : NodeJS . ProcessEnv ) => Thenable < boolean | undefined > , btn : string , outdatedCheck ?: ( log : string ) => ( boolean | [ boolean , string ] ) ) : Promise < boolean | undefined > {
496496 var version = "" ;
497497
498498 try {
@@ -514,7 +514,7 @@ async function preStartup(context: vscode.ExtensionContext) {
514514 } ;
515515
516516 if ( err && err . code == "ENOENT" ) {
517- if ( config ( null ) . get ( "aggressiveUpdate" , true ) ) {
517+ if ( config ( null ) . get ( "aggressiveUpdate" , true ) && ! forced ) {
518518 return installFunc ( process . env ) ;
519519 }
520520 else {
@@ -661,12 +661,16 @@ async function preStartup(context: vscode.ExtensionContext) {
661661 } ) ;
662662 }
663663
664- let force = true ; // force release lookup before first install
664+ let firstTimeUser = true ; // force release lookup before first install
665+ let force = false ;
666+ const currentCodedServedIteration = 1 ; // bump on new code-d releases that want new serve-d
665667 if ( context . globalState . get ( "serve-d-downloaded-release-channel" ) )
666- force = false ;
668+ firstTimeUser = false ;
669+ if ( context . globalState . get < number > ( "serve-d-wanted-download-iteration" , 0 ) != currentCodedServedIteration )
670+ force = true ;
667671
668- let version = await findLatestServeD ( force , channelString ) ;
669- let upToDate = await checkProgram ( "servedPath" , "serve-d" , "serve-d" ,
672+ let version = await findLatestServeD ( firstTimeUser || force , channelString ) ;
673+ let upToDate = await checkProgram ( force , "servedPath" , "serve-d" , "serve-d" ,
670674 version ? ( version . asset
671675 ? installServeD ( [ { url : version . asset . browser_download_url , title : "Serve-D" } ] , version . name )
672676 : compileServeD ( ( version && version . name != "nightly" ) ? version . name : undefined ) )
@@ -676,6 +680,7 @@ async function preStartup(context: vscode.ExtensionContext) {
676680 return ; /* user dismissed install dialogs, don't continue startup */
677681
678682 await context . globalState . update ( "serve-d-downloaded-release-channel" , channelString ) ;
683+ await context . globalState . update ( "serve-d-wanted-download-iteration" , currentCodedServedIteration ) ;
679684
680685 if ( outdated ) {
681686 if ( ! reloading ) {
0 commit comments