diff options
| author | wxb1ank <wxblank@gmail.com> | 2021-05-23 16:33:32 -0400 |
|---|---|---|
| committer | wxb1ank <wxblank@gmail.com> | 2021-06-02 12:07:13 -0400 |
| commit | 3ca7f61a8d736d8e56f0d413b109e6e6562c0a30 (patch) | |
| tree | 8f96da409d488f83db4f9011c8013a09a972d1be /editors/code | |
| parent | 2022cfce44f7c3d82dd354abeb2d40b570fa3ef4 (diff) | |
| download | rust-3ca7f61a8d736d8e56f0d413b109e6e6562c0a30.tar.gz rust-3ca7f61a8d736d8e56f0d413b109e6e6562c0a30.zip | |
internal: use vscode.FileSystem API in main.ts
Diffstat (limited to 'editors/code')
| -rw-r--r-- | editors/code/src/config.ts | 4 | ||||
| -rw-r--r-- | editors/code/src/main.ts | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index d3d6e631a02..7200a26f72a 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -31,10 +31,10 @@ export class Config { enableProposedApi: boolean | undefined; } = vscode.extensions.getExtension(this.extensionId)!.packageJSON; - readonly globalStoragePath: string; + readonly globalStorageUri: vscode.Uri; constructor(ctx: vscode.ExtensionContext) { - this.globalStoragePath = ctx.globalStorageUri.fsPath; + this.globalStorageUri = ctx.globalStorageUri; vscode.workspace.onDidChangeConfiguration(this.onDidChangeConfiguration, this, ctx.subscriptions); this.refreshLogging(); } diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts index 74ee28d2457..fb9d38a14dd 100644 --- a/editors/code/src/main.ts +++ b/editors/code/src/main.ts @@ -160,7 +160,7 @@ export async function deactivate() { } async function bootstrap(config: Config, state: PersistentState): Promise<string> { - await fs.mkdir(config.globalStoragePath, { recursive: true }); + await vscode.workspace.fs.createDirectory(config.globalStorageUri); if (!config.currentExtensionIsNightly) { await state.updateNightlyReleaseId(undefined); @@ -222,7 +222,7 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi const artifact = latestNightlyRelease.assets.find(artifact => artifact.name === "rust-analyzer.vsix"); assert(!!artifact, `Bad release: ${JSON.stringify(latestNightlyRelease)}`); - const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix"); + const dest = path.join(config.globalStorageUri.path, "rust-analyzer.vsix"); await downloadWithRetryDialog(state, async () => { await download({ @@ -334,7 +334,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string platform = "x86_64-unknown-linux-musl"; } const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : ""; - const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`); + const dest = path.join(config.globalStorageUri.path, `rust-analyzer-${platform}${ext}`); const exists = await fs.stat(dest).then(() => true, () => false); if (!exists) { await state.updateServerVersion(undefined); |
