storage - put migration behind flag
This commit is contained in:
parent
b1f1140ac9
commit
b9e55b7047
20
src/main.js
20
src/main.js
|
@ -30,16 +30,18 @@ const userDataPath = getUserDataPath(args);
|
|||
|
||||
// TODO@Ben global storage migration needs to happen very early before app.on("ready")
|
||||
// We copy the DB instead of moving it to ensure we are not running into locking issues
|
||||
try {
|
||||
const globalStorageHome = path.join(userDataPath, 'User', 'globalStorage', 'temp.vscdb');
|
||||
const localStorageHome = path.join(userDataPath, 'Local Storage');
|
||||
const localStorageDB = path.join(localStorageHome, 'file__0.localstorage');
|
||||
const localStorageDBBackup = path.join(localStorageHome, 'file__0.localstorage.vscmig');
|
||||
if (!fs.existsSync(globalStorageHome) && fs.existsSync(localStorageDB)) {
|
||||
fs.copyFileSync(localStorageDB, localStorageDBBackup);
|
||||
if (process.env['VSCODE_TEST_STORAGE_MIGRATION']) {
|
||||
try {
|
||||
const globalStorageHome = path.join(userDataPath, 'User', 'globalStorage', 'temp.vscdb');
|
||||
const localStorageHome = path.join(userDataPath, 'Local Storage');
|
||||
const localStorageDB = path.join(localStorageHome, 'file__0.localstorage');
|
||||
const localStorageDBBackup = path.join(localStorageHome, 'file__0.localstorage.vscmig');
|
||||
if (!fs.existsSync(globalStorageHome) && fs.existsSync(localStorageDB)) {
|
||||
fs.copyFileSync(localStorageDB, localStorageDBBackup);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
app.setPath('userData', userDataPath);
|
||||
|
|
|
@ -98,7 +98,7 @@ export class StorageMainService extends Disposable implements IStorageMainServic
|
|||
}
|
||||
|
||||
private get storagePath(): string {
|
||||
if (!!this.environmentService.extensionTestsPath) {
|
||||
if (!!this.environmentService.extensionTestsPath || !process.env['VSCODE_TEST_STORAGE_MIGRATION']) {
|
||||
return SQLiteStorageDatabase.IN_MEMORY_PATH; // no storage during extension tests!
|
||||
}
|
||||
|
||||
|
|
|
@ -535,7 +535,9 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
|
|||
get(key: string, scope: StorageScope, fallbackValue: string): string;
|
||||
get(key: string, scope: StorageScope, fallbackValue?: string): string | undefined {
|
||||
if (!this.useLegacyWorkspaceStorage) {
|
||||
return this.storageService.get(key, scope, fallbackValue);
|
||||
if (scope === StorageScope.WORKSPACE || process.env['VSCODE_TEST_STORAGE_MIGRATION']) {
|
||||
return this.storageService.get(key, scope, fallbackValue);
|
||||
}
|
||||
}
|
||||
|
||||
return this.storageLegacyService.get(key, this.convertScope(scope), fallbackValue);
|
||||
|
@ -544,7 +546,9 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
|
|||
getBoolean(key: string, scope: StorageScope, fallbackValue: boolean): boolean;
|
||||
getBoolean(key: string, scope: StorageScope, fallbackValue?: boolean): boolean | undefined {
|
||||
if (!this.useLegacyWorkspaceStorage) {
|
||||
return this.storageService.getBoolean(key, scope, fallbackValue);
|
||||
if (scope === StorageScope.WORKSPACE || process.env['VSCODE_TEST_STORAGE_MIGRATION']) {
|
||||
return this.storageService.getBoolean(key, scope, fallbackValue);
|
||||
}
|
||||
}
|
||||
|
||||
return this.storageLegacyService.getBoolean(key, this.convertScope(scope), fallbackValue);
|
||||
|
@ -553,7 +557,9 @@ export class DelegatingStorageService extends Disposable implements IStorageServ
|
|||
getInteger(key: string, scope: StorageScope, fallbackValue: number): number;
|
||||
getInteger(key: string, scope: StorageScope, fallbackValue?: number): number | undefined {
|
||||
if (!this.useLegacyWorkspaceStorage) {
|
||||
return this.storageService.getInteger(key, scope, fallbackValue);
|
||||
if (scope === StorageScope.WORKSPACE || process.env['VSCODE_TEST_STORAGE_MIGRATION']) {
|
||||
return this.storageService.getInteger(key, scope, fallbackValue);
|
||||
}
|
||||
}
|
||||
|
||||
return this.storageLegacyService.getInteger(key, this.convertScope(scope), fallbackValue);
|
||||
|
|
Loading…
Reference in a new issue