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:
@@ -505,7 +505,7 @@ class ExtensionSpecificDistributionManager {
|
||||
0,
|
||||
) || "";
|
||||
return join(
|
||||
this.extensionContext.globalStoragePath,
|
||||
this.extensionContext.globalStorageUri.fsPath,
|
||||
ExtensionSpecificDistributionManager._currentDistributionFolderBaseName +
|
||||
distributionFolderIndex,
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user