debt - remove state migration (#151402)

pull/151405/head
Benjamin Pasero 2022-06-07 09:55:39 +02:00 committed by GitHub
parent bf757ca01e
commit f3a57f6955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 13 deletions

View File

@ -5,11 +5,9 @@
import { ThrottledDelayer } from 'vs/base/common/async';
import { VSBuffer } from 'vs/base/common/buffer';
import { join } from 'vs/base/common/path';
import { joinPath } from 'vs/base/common/resources';
import { isUndefined, isUndefinedOrNull } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { Promises } from 'vs/base/node/pfs';
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
import { FileOperationError, FileOperationResult, IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
@ -153,29 +151,19 @@ export class StateMainService implements IStateMainService {
private static readonly STATE_FILE = 'storage.json';
private readonly legacyStateFilePath = URI.file(join(this.environmentMainService.userDataPath, StateMainService.STATE_FILE));
private readonly stateFilePath = joinPath(this.environmentMainService.globalStorageHome, StateMainService.STATE_FILE);
private readonly fileStorage: FileStorage;
constructor(
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
@ILogService private readonly logService: ILogService,
@ILogService logService: ILogService,
@IFileService fileService: IFileService
) {
this.fileStorage = new FileStorage(this.stateFilePath, logService, fileService);
}
async init(): Promise<void> {
try {
// TODO@bpasero remove legacy migration eventually
await Promises.move(this.legacyStateFilePath.fsPath, this.stateFilePath.fsPath);
} catch (error) {
if (error.code !== 'ENOENT') {
this.logService.error(error);
}
}
return this.fileStorage.init();
}