@@ -262,6 +262,11 @@ async function onSelectSerialBaudrate() {
262262 }
263263}
264264
265+ function checkBinFolder ( binFolder : File ) : boolean {
266+ return binFolder . IsDir ( ) &&
267+ File . fromArray ( [ binFolder . path , File . ToLocalPath ( 'lib/mono/4.5/mscorlib.dll' ) ] ) . IsFile ( ) ;
268+ }
269+
265270async function checkAndInstallBinaries ( constex : vscode . ExtensionContext , forceInstall ?: boolean ) : Promise < boolean > {
266271
267272 const eideCfg = ResManager . GetInstance ( ) . getAppConfig < any > ( ) ;
@@ -277,30 +282,29 @@ async function checkAndInstallBinaries(constex: vscode.ExtensionContext, forceIn
277282 }
278283
279284 // if 'bin' dir is existed, we exit, if not, we need install eide-binaries
280- else if ( binFolder . IsDir ( ) &&
281- File . fromArray ( [ binFolder . path , File . ToLocalPath ( 'lib/mono/4.5/mscorlib.dll' ) ] ) . IsFile ( ) ) {
285+ else if ( checkBinFolder ( binFolder ) ) {
282286 // if user enabled auto-update, we try get new version from
283287 // github, and install it at background after 1 min delay
284288 //if (SettingManager.GetInstance().isEnableAutoUpdateEideBinaries()) {
285- setTimeout ( async ( ) => {
286- // get local binary version from disk
287- const verFile = File . fromArray ( [ binFolder . path , 'VERSION' ] ) ;
288- if ( verFile . IsFile ( ) ) {
289- const cont = verFile . Read ( ) . trim ( ) ;
290- if ( utility . isVersionString ( cont ) ) {
291- localVersion = cont ;
292- }
289+ setTimeout ( async ( ) => {
290+ // get local binary version from disk
291+ const verFile = File . fromArray ( [ binFolder . path , 'VERSION' ] ) ;
292+ if ( verFile . IsFile ( ) ) {
293+ const cont = verFile . Read ( ) . trim ( ) ;
294+ if ( utility . isVersionString ( cont ) ) {
295+ localVersion = cont ;
293296 }
294- // try update
295- const done = await tryUpdateBinaries ( binFolder , localVersion ) ;
296- if ( ! done ) {
297- const msg = `Update eide-binaries failed, please restart vscode !` ;
298- const sel = await vscode . window . showErrorMessage ( msg , 'Restart' , 'Cancel' ) ;
299- if ( sel == 'Restart' ) {
300- vscode . commands . executeCommand ( 'workbench.action.reloadWindow' ) ;
301- }
297+ }
298+ // try update
299+ const done = await tryUpdateBinaries ( binFolder , localVersion ) ;
300+ if ( ! done ) {
301+ const msg = `Update eide-binaries failed, please restart vscode !` ;
302+ const sel = await vscode . window . showErrorMessage ( msg , 'Restart' , 'Cancel' ) ;
303+ if ( sel == 'Restart' ) {
304+ vscode . commands . executeCommand ( 'workbench.action.reloadWindow' ) ;
302305 }
303- } , 5 * 1000 ) ;
306+ }
307+ } , 5 * 1000 ) ;
304308 //}
305309 return true ;
306310 }
@@ -341,7 +345,7 @@ async function tryUpdateBinaries(binFolder: File, localVer: string, notConfirm?:
341345 }
342346
343347 // check bin folder
344- if ( binFolder . IsDir ( ) ) {
348+ if ( checkBinFolder ( binFolder ) ) {
345349
346350 // not need update, exit now
347351 if ( binVersion == localVer ) {
0 commit comments