@@ -534,15 +534,6 @@ export class ProjectConfiguration<T extends BuilderConfigData>
534534 toRelativePath : ( path ) => this . toRelativePath ( path )
535535 } ;
536536
537- // compate old version
538- if ( Array . isArray ( this . config . virtualFolder ) ) {
539- this . config . virtualFolder = {
540- name : VirtualSource . rootName ,
541- files : [ ] ,
542- folders : this . config . virtualFolder
543- } ;
544- }
545-
546537 // init project
547538
548539 this . compileConfigModel = CompileConfigModel . getInstance ( this . config ) ;
@@ -1329,13 +1320,40 @@ export class ProjectConfiguration<T extends BuilderConfigData>
13291320
13301321 //---
13311322
1323+ private excludeKeysInFile : string [ ] = [
1324+ 'mode' ,
1325+ 'excludeList' ,
1326+ 'toolchain' ,
1327+ 'compileConfig' ,
1328+ 'uploader' ,
1329+ 'uploadConfig' ,
1330+ 'uploadConfigMap'
1331+ ] ;
1332+
13321333 protected afterSetConfigData ( ) {
13331334
13341335 //
13351336 // load target
13361337 //
13371338
1338- // compatible with old project
1339+ // compatible missing field for old project
1340+ const defCfg = this . GetDefault ( this . config . type ) ;
1341+ for ( const key in defCfg ) {
1342+ if ( this . config [ key ] == undefined &&
1343+ this . excludeKeysInFile . includes ( key ) == false ) {
1344+ this . config [ key ] = defCfg [ key ] ;
1345+ }
1346+ }
1347+
1348+ // compatible virtualFolder field for old project
1349+ if ( Array . isArray ( this . config . virtualFolder ) ) {
1350+ this . config . virtualFolder = {
1351+ name : VirtualSource . rootName ,
1352+ files : [ ] ,
1353+ folders : this . config . virtualFolder
1354+ } ;
1355+ }
1356+
13391357 // old project(ver < 3.3) have 'mode' field
13401358 // new project(ver >= 3.3) not have 'mode' field
13411359 if ( this . config . mode == undefined ) {
@@ -1389,17 +1407,7 @@ export class ProjectConfiguration<T extends BuilderConfigData>
13891407 }
13901408 }
13911409
1392- const excKeys = [
1393- 'mode' ,
1394- 'excludeList' ,
1395- 'toolchain' ,
1396- 'compileConfig' ,
1397- 'uploader' ,
1398- 'uploadConfig' ,
1399- 'uploadConfigMap'
1400- ] ;
1401-
1402- return utility . ToJsonStringExclude ( eidePrjObj , excKeys , 2 ) ;
1410+ return utility . ToJsonStringExclude ( eidePrjObj , excludeKeysInFile , 2 ) ;
14031411 }
14041412
14051413 Save ( force ?: boolean ) {
0 commit comments