Skip to content

Commit 173be66

Browse files
committed
Adopt backupMainService to folder URIs
1 parent fd7d83f commit 173be66

5 files changed

Lines changed: 347 additions & 281 deletions

File tree

src/vs/code/electron-main/windows.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ export class WindowsManager implements IWindowsMainService {
400400
let workspacesToRestore: IWorkspaceIdentifier[] = [];
401401
let emptyToRestore: string[] = [];
402402
if (openConfig.initialStartup && !openConfig.cli.extensionDevelopmentPath && !openConfig.cli['disable-restore-windows']) {
403-
foldersToRestore = this.backupMainService.getFolderBackupPaths().map(path => URI.file(path));
403+
foldersToRestore = this.backupMainService.getFolderBackupPaths();
404404

405405
workspacesToRestore = this.backupMainService.getWorkspaceBackups(); // collect from workspaces with hot-exit backups
406406
workspacesToRestore.push(...this.workspacesMainService.getUntitledWorkspacesSync()); // collect from previous window session
@@ -1203,7 +1203,7 @@ export class WindowsManager implements IWindowsMainService {
12031203
if (configuration.workspace) {
12041204
configuration.backupPath = this.backupMainService.registerWorkspaceBackupSync(configuration.workspace);
12051205
} else if (configuration.folderUri) {
1206-
configuration.backupPath = this.backupMainService.registerFolderBackupSync(configuration.folderUri.fsPath);
1206+
configuration.backupPath = this.backupMainService.registerFolderBackupSync(configuration.folderUri);
12071207
} else {
12081208
configuration.backupPath = this.backupMainService.registerEmptyWindowBackupSync(options.emptyWindowBackupFolder);
12091209
}

src/vs/platform/backup/common/backup.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55

66
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
77
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
8+
import URI from 'vs/base/common/uri';
89

910
export interface IBackupWorkspacesFormat {
1011
rootWorkspaces: IWorkspaceIdentifier[];
11-
folderWorkspaces: string[];
12+
folderURIWorkspaces: string[];
1213
emptyWorkspaces: string[];
14+
15+
// deprecated
16+
folderWorkspaces?: string[]; // use folderURIWorkspaces instead
1317
}
1418

1519
export const IBackupMainService = createDecorator<IBackupMainService>('backupMainService');
@@ -20,10 +24,14 @@ export interface IBackupMainService {
2024
isHotExitEnabled(): boolean;
2125

2226
getWorkspaceBackups(): IWorkspaceIdentifier[];
23-
getFolderBackupPaths(): string[];
27+
getFolderBackupPaths(): URI[];
2428
getEmptyWindowBackupPaths(): string[];
2529

2630
registerWorkspaceBackupSync(workspace: IWorkspaceIdentifier, migrateFrom?: string): string;
27-
registerFolderBackupSync(folderPath: string): string;
31+
registerFolderBackupSync(folderPath: URI): string;
2832
registerEmptyWindowBackupSync(backupFolder?: string): string;
33+
34+
unregisterWorkspaceBackupSync(workspace: IWorkspaceIdentifier): void;
35+
unregisterFolderBackupSync(folderPath: URI): void;
36+
unregisterEmptyWindowBackupSync(backupFolder: string): void;
2937
}

0 commit comments

Comments
 (0)