Skip to content

Commit 8cbdf09

Browse files
committed
make back up workspace path URI
1 parent 118e351 commit 8cbdf09

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/vs/platform/windows/common/windows.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ export interface IWindowConfiguration extends ParsedArgs {
419419
nodeCachedDataDir?: string;
420420

421421
backupPath?: string;
422+
backupWorkspaceResource?: URI;
422423

423424
workspace?: IWorkspaceIdentifier;
424425
folderUri?: ISingleFolderWorkspaceIdentifier;

src/vs/workbench/services/backup/common/backupFileService.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ export class BackupFileService implements IBackupFileService {
114114
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
115115
@IFileService fileService: IFileService
116116
) {
117-
const backupWorkspacePath = environmentService.configuration.backupPath;
118-
if (backupWorkspacePath) {
119-
this.impl = new BackupFileServiceImpl(backupWorkspacePath, this.hashPath, environmentService, fileService);
117+
const backupWorkspaceResource = environmentService.configuration.backupWorkspaceResource;
118+
if (backupWorkspaceResource) {
119+
this.impl = new BackupFileServiceImpl(backupWorkspaceResource, this.hashPath, environmentService, fileService);
120120
} else {
121121
this.impl = new InMemoryBackupFileService(this.hashPath);
122122
}
@@ -127,9 +127,9 @@ export class BackupFileService implements IBackupFileService {
127127
return hash(str).toString(16);
128128
}
129129

130-
initialize(backupWorkspacePath: string): void {
130+
initialize(backupWorkspaceResource: URI): void {
131131
if (this.impl instanceof BackupFileServiceImpl) {
132-
this.impl.initialize(backupWorkspacePath);
132+
this.impl.initialize(backupWorkspaceResource);
133133
}
134134
}
135135

@@ -181,19 +181,19 @@ class BackupFileServiceImpl implements IBackupFileService {
181181
private ioOperationQueues: ResourceQueue; // queue IO operations to ensure write order
182182

183183
constructor(
184-
backupWorkspacePath: string,
184+
backupWorkspaceResource: URI,
185185
private readonly hashPath: (resource: URI) => string,
186186
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
187187
@IFileService private readonly fileService: IFileService
188188
) {
189189
this.isShuttingDown = false;
190190
this.ioOperationQueues = new ResourceQueue();
191191

192-
this.initialize(backupWorkspacePath);
192+
this.initialize(backupWorkspaceResource);
193193
}
194194

195-
initialize(backupWorkspacePath: string): void {
196-
this.backupWorkspacePath = joinPath(this.environmentService.userRoamingDataHome, relativePath(URI.file(this.environmentService.userDataPath), URI.file(backupWorkspacePath))!);
195+
initialize(backupWorkspaceResource: URI): void {
196+
this.backupWorkspacePath = joinPath(this.environmentService.userRoamingDataHome, relativePath(URI.file(this.environmentService.userDataPath), backupWorkspaceResource)!);
197197

198198
this.ready = this.init();
199199
}

src/vs/workbench/services/environment/node/environmentService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class WorkbenchEnvironmentService extends EnvironmentService implements I
1919
execPath: string
2020
) {
2121
super(_configuration, execPath);
22+
this._configuration.backupWorkspaceResource = this._configuration.backupPath ? URI.file(this._configuration.backupPath) : undefined;
2223
}
2324

2425
get configuration(): IWindowConfiguration {

src/vs/workbench/services/workspace/electron-browser/workspaceEditingService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export class WorkspaceEditingService implements IWorkspaceEditingService {
397397
await this.migrateStorage(result.workspace);
398398
// Reinitialize backup service
399399
if (this.backupFileService instanceof BackupFileService) {
400-
this.backupFileService.initialize(result.backupPath!);
400+
this.backupFileService.initialize(URI.file(result.backupPath!));
401401
}
402402
}
403403

0 commit comments

Comments
 (0)