mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 18:49:00 +01:00
#23251 Expose global storage path in proposed API
This commit is contained in:
@@ -50,6 +50,7 @@ export interface IEnvironment {
|
||||
appSettingsHome: URI;
|
||||
extensionDevelopmentLocationURI: URI;
|
||||
extensionTestsPath: string;
|
||||
globalStorageHome: string;
|
||||
}
|
||||
|
||||
export interface IWorkspaceData {
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface IExtensionContext {
|
||||
globalState: IExtensionMemento;
|
||||
extensionPath: string;
|
||||
storagePath: string;
|
||||
globalStoragePath: string;
|
||||
asAbsolutePath(relativePath: string): string;
|
||||
readonly logPath: string;
|
||||
}
|
||||
|
||||
@@ -91,13 +91,17 @@ class ExtensionStoragePath {
|
||||
return this._ready;
|
||||
}
|
||||
|
||||
value(extension: IExtensionDescription): string {
|
||||
workspaceValue(extension: IExtensionDescription): string {
|
||||
if (this._value) {
|
||||
return join(this._value, extension.id);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
globalValue(extension: IExtensionDescription): string {
|
||||
return join(this._environment.globalStorageHome, extension.id);
|
||||
}
|
||||
|
||||
private async _getOrCreateWorkspaceStoragePath(): Promise<string> {
|
||||
if (!this._workspace) {
|
||||
return Promise.resolve(undefined);
|
||||
@@ -383,7 +387,8 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
workspaceState,
|
||||
subscriptions: [],
|
||||
get extensionPath() { return extensionDescription.extensionLocation.fsPath; },
|
||||
storagePath: this._storagePath.value(extensionDescription),
|
||||
storagePath: this._storagePath.workspaceValue(extensionDescription),
|
||||
globalStoragePath: this._storagePath.globalValue(extensionDescription),
|
||||
asAbsolutePath: (relativePath: string) => { return join(extensionDescription.extensionLocation.fsPath, relativePath); },
|
||||
logPath: that._extHostLogService.getLogDirectory(extensionDescription.id)
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user