@@ -111,15 +111,10 @@ export class BackupFileService implements IBackupFileService {
111111 private impl : IBackupFileService ;
112112
113113 constructor (
114- @IWorkbenchEnvironmentService environmentService : IWorkbenchEnvironmentService ,
115- @IFileService fileService : IFileService
114+ @IWorkbenchEnvironmentService private environmentService : IWorkbenchEnvironmentService ,
115+ @IFileService protected fileService : IFileService
116116 ) {
117- const backupWorkspaceResource = environmentService . configuration . backupWorkspaceResource ;
118- if ( backupWorkspaceResource ) {
119- this . impl = new BackupFileServiceImpl ( backupWorkspaceResource , this . hashPath , fileService ) ;
120- } else {
121- this . impl = new InMemoryBackupFileService ( this . hashPath ) ;
122- }
117+ this . initialize ( ) ;
123118 }
124119
125120 protected hashPath ( resource : URI ) : string {
@@ -128,9 +123,25 @@ export class BackupFileService implements IBackupFileService {
128123 return hash ( str ) . toString ( 16 ) ;
129124 }
130125
131- initialize ( backupWorkspaceResource : URI ) : void {
126+ private initialize ( ) : void {
127+ const backupWorkspaceResource = this . environmentService . configuration . backupWorkspaceResource ;
128+ if ( backupWorkspaceResource ) {
129+ this . impl = new BackupFileServiceImpl ( backupWorkspaceResource , this . hashPath , this . fileService ) ;
130+ } else {
131+ this . impl = new InMemoryBackupFileService ( this . hashPath ) ;
132+ }
133+ }
134+
135+ reinitialize ( ) : void {
136+
137+ // Re-init implementation (unless we are running in-memory)
132138 if ( this . impl instanceof BackupFileServiceImpl ) {
133- this . impl . initialize ( backupWorkspaceResource ) ;
139+ const backupWorkspaceResource = this . environmentService . configuration . backupWorkspaceResource ;
140+ if ( backupWorkspaceResource ) {
141+ this . impl . initialize ( backupWorkspaceResource ) ;
142+ } else {
143+ this . impl = new InMemoryBackupFileService ( this . hashPath ) ;
144+ }
134145 }
135146 }
136147
0 commit comments