Replace deprecated storagePath by storageUri

This replaces access to the deprecated `storagePath` and
`globalStoragePath` to use `storageUri` and `globalStorageUri` instead.
This commit is contained in:
Koen Vlaswinkel
2023-05-08 14:04:24 +02:00
parent 3ad006de92
commit a414213804
3 changed files with 5 additions and 5 deletions

View File

@@ -505,7 +505,7 @@ class ExtensionSpecificDistributionManager {
0,
) || "";
return join(
this.extensionContext.globalStoragePath,
this.extensionContext.globalStorageUri.fsPath,
ExtensionSpecificDistributionManager._currentDistributionFolderBaseName +
distributionFolderIndex,
);

View File

@@ -1152,12 +1152,12 @@ export class DatabaseManager extends DisposableObject {
}
private isExtensionControlledLocation(uri: vscode.Uri) {
const storagePath = this.ctx.storagePath || this.ctx.globalStoragePath;
const storageUri = this.ctx.storageUri || this.ctx.globalStorageUri;
// the uri.fsPath function on windows returns a lowercase drive letter,
// but storagePath will have an uppercase drive letter. Be sure to compare
// URIs to URIs only
if (storagePath) {
return uri.fsPath.startsWith(vscode.Uri.file(storagePath).fsPath);
if (storageUri) {
return uri.fsPath.startsWith(storageUri.fsPath);
}
return false;
}

View File

@@ -277,7 +277,7 @@ describe("local databases", () => {
updateSpy.mockClear();
// pretend that the database location is not controlled by the extension
(databaseManager as any).ctx.storagePath = "hucairz";
(databaseManager as any).ctx.storageUri = Uri.file("hucairz");
extensionContextStoragePath = "hucairz";
await databaseManager.removeDatabaseItem(