@@ -16,30 +16,24 @@ import { IAnyWorkspaceIdentifier, IEmptyWorkspaceIdentifier, ISingleFolderWorksp
16
16
17
17
export class NativeStorageService extends AbstractStorageService {
18
18
19
- private readonly applicationStorage : IStorage ;
20
- private readonly applicationStorageProfile : IUserDataProfile ;
19
+ private readonly applicationStorageProfile = this . initialProfiles . defaultProfile ;
20
+ private readonly applicationStorage = this . createApplicationStorage ( ) ;
21
21
22
- private profileStorage : IStorage ;
23
- private profileStorageProfile : IUserDataProfile | undefined = undefined ;
22
+ private profileStorageProfile = this . initialProfiles . currentProfile ;
24
23
private readonly profileStorageDisposables = this . _register ( new DisposableStore ( ) ) ;
24
+ private profileStorage = this . createProfileStorage ( this . profileStorageProfile ) ;
25
25
26
- private workspaceStorage : IStorage | undefined = undefined ;
27
- private workspaceStorageId : string | undefined = undefined ;
26
+ private workspaceStorageId = this . initialWorkspace ?. id ;
28
27
private readonly workspaceStorageDisposables = this . _register ( new DisposableStore ( ) ) ;
28
+ private workspaceStorage = this . createWorkspaceStorage ( this . initialWorkspace ) ;
29
29
30
30
constructor (
31
- workspace : IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IEmptyWorkspaceIdentifier | undefined ,
32
- { defaultProfile , currentProfile } : { defaultProfile : IUserDataProfile ; currentProfile : IUserDataProfile } ,
31
+ private readonly initialWorkspace : IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | IEmptyWorkspaceIdentifier | undefined ,
32
+ private readonly initialProfiles : { defaultProfile : IUserDataProfile ; currentProfile : IUserDataProfile } ,
33
33
private readonly mainProcessService : IMainProcessService ,
34
34
private readonly environmentService : IEnvironmentService
35
35
) {
36
36
super ( ) ;
37
-
38
- this . applicationStorageProfile = defaultProfile ;
39
-
40
- this . applicationStorage = this . createApplicationStorage ( ) ;
41
- this . profileStorage = this . createProfileStorage ( currentProfile ) ;
42
- this . workspaceStorage = this . createWorkspaceStorage ( workspace ) ;
43
37
}
44
38
45
39
private createApplicationStorage ( ) : IStorage {
@@ -148,7 +142,7 @@ export class NativeStorageService extends AbstractStorageService {
148
142
}
149
143
150
144
protected async switchToProfile ( toProfile : IUserDataProfile , preserveData : boolean ) : Promise < void > {
151
- if ( this . profileStorageProfile && ! this . canSwitchProfile ( this . profileStorageProfile , toProfile ) ) {
145
+ if ( ! this . canSwitchProfile ( this . profileStorageProfile , toProfile ) ) {
152
146
return ;
153
147
}
154
148
0 commit comments