@@ -245,7 +245,21 @@ export abstract class Configuration<ConfigType = any, EventType = any> {
245245 }
246246
247247 Save ( force ?: boolean ) : void {
248- this . cfgFile . Write ( this . ToJson ( ) ) ;
248+
249+ let oldContent : string | undefined ;
250+ let newContent : string | undefined = this . ToJson ( ) ;
251+
252+ try {
253+ if ( this . cfgFile . IsExist ( ) ) {
254+ oldContent = this . cfgFile . Read ( ) ;
255+ }
256+ } catch ( error ) {
257+ GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Warning' ) ) ;
258+ }
259+
260+ if ( oldContent != newContent ) {
261+ this . cfgFile . Write ( newContent ) ;
262+ }
249263 }
250264
251265 protected afterInitConfigData ( ) {
@@ -1221,10 +1235,25 @@ export class ProjectConfiguration<T extends BuilderConfigData>
12211235 } ;
12221236
12231237 setProjectUsrCtx ( data : ProjectUserContextData ) {
1238+
1239+ const usrCtxFile = this . getProjectUsrCtxFile ( ) ;
1240+
1241+ let oldUsrCtxCont : string | undefined ;
1242+ if ( usrCtxFile . IsExist ( ) ) {
1243+ try {
1244+ oldUsrCtxCont = usrCtxFile . Read ( ) ;
1245+ } catch ( error ) {
1246+ GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Warning' ) ) ;
1247+ }
1248+ }
1249+
12241250 try {
1225- this . getProjectUsrCtxFile ( ) . Write ( JSON . stringify ( data , undefined , 4 ) ) ;
1251+ let newUsrCtxCont = JSON . stringify ( data , undefined , 4 ) ;
1252+ if ( oldUsrCtxCont != newUsrCtxCont ) {
1253+ usrCtxFile . Write ( newUsrCtxCont ) ;
1254+ }
12261255 } catch ( error ) {
1227- GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Warning ' ) ) ;
1256+ GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Error ' ) ) ;
12281257 }
12291258 }
12301259
0 commit comments