Skip to content

Commit 99a0740

Browse files
committed
1 parent 5cdc320 commit 99a0740

2 files changed

Lines changed: 15 additions & 16 deletions

File tree

src/vs/platform/environment/node/environmentService.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface INativeEnvironmentService extends IEnvironmentService {
3636
installSourcePath: string;
3737

3838
extensionsPath?: string;
39-
extensionsDownloadPath?: string;
39+
extensionsDownloadPath: string;
4040
builtinExtensionsPath: string;
4141

4242
globalStorageHome: string;
@@ -151,8 +151,13 @@ export class EnvironmentService implements INativeEnvironmentService {
151151
}
152152
}
153153

154-
get extensionsDownloadPath(): string | undefined {
155-
return parsePathArg(this._args['extensions-download-dir'], process);
154+
get extensionsDownloadPath(): string {
155+
const fromArgs = parsePathArg(this._args['extensions-download-dir'], process);
156+
if (fromArgs) {
157+
return fromArgs;
158+
} else {
159+
return path.join(this.userDataPath, 'CachedExtensionVSIXs');
160+
}
156161
}
157162

158163
@memoize

src/vs/platform/extensionManagement/node/extensionDownloader.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { tmpdir } from 'os';
76
import { Disposable } from 'vs/base/common/lifecycle';
87
import { IFileService, IFileStatWithMetadata } from 'vs/platform/files/common/files';
98
import { IExtensionGalleryService, IGalleryExtension, InstallOperation } from 'vs/platform/extensionManagement/common/extensionManagement';
@@ -20,9 +19,9 @@ const ExtensionIdVersionRegex = /^([^.]+\..+)-(\d+\.\d+\.\d+)$/;
2019

2120
export class ExtensionsDownloader extends Disposable {
2221

23-
private readonly extensionsDownloadDir: URI = URI.file(tmpdir());
24-
private readonly cache: number = 0;
25-
private readonly cleanUpPromise: Promise<void> = Promise.resolve();
22+
private readonly extensionsDownloadDir: URI;
23+
private readonly cache: number;
24+
private readonly cleanUpPromise: Promise<void>;
2625

2726
constructor(
2827
@IEnvironmentService environmentService: INativeEnvironmentService,
@@ -31,11 +30,9 @@ export class ExtensionsDownloader extends Disposable {
3130
@ILogService private readonly logService: ILogService,
3231
) {
3332
super();
34-
if (environmentService.extensionsDownloadPath) {
35-
this.extensionsDownloadDir = URI.file(environmentService.extensionsDownloadPath);
36-
this.cache = 20; // Cache 20 downloads
37-
this.cleanUpPromise = this.cleanUp();
38-
}
33+
this.extensionsDownloadDir = URI.file(environmentService.extensionsDownloadPath);
34+
this.cache = 20; // Cache 20 downloads
35+
this.cleanUpPromise = this.cleanUp();
3936
}
4037

4138
async downloadExtension(extension: IGalleryExtension, operation: InstallOperation): Promise<URI> {
@@ -46,10 +43,7 @@ export class ExtensionsDownloader extends Disposable {
4643
}
4744

4845
async delete(location: URI): Promise<void> {
49-
// Delete immediately if caching is disabled
50-
if (!this.cache) {
51-
await this.fileService.del(location);
52-
}
46+
// noop as caching is enabled always
5347
}
5448

5549
private async download(extension: IGalleryExtension, location: URI, operation: InstallOperation): Promise<void> {

0 commit comments

Comments
 (0)