Skip to content

Commit f7be371

Browse files
create the bootstrap .version file in the extensions directory rather than the application directory (#6554)
@midleman and @testlabauto reported that their tests relying on extensions were failing locally. This is because the bootstrapped extension feature was saving `.version` to the application folder rather than the user's extension folder, causing the bootstrapped extensions to only be installed for the first user that launched the application. Because the tests use a temporary user data directory per run, the extensions would not be installed on subsequent runs. This would've prevented extensions from being installed for multiple users on Workbench as well. We now create, look for, and update `.version` in the user's extension directory rather that the application directory. In the implementation, `storageFilePath` was unnecessarily being declared as a class member so I fixed that as well.
1 parent 2199bb0 commit f7be371

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { existsSync, readFileSync, writeFileSync } from 'fs';
1515
import { Disposable } from '../../../base/common/lifecycle.js';
1616

1717
export class PositronBootstrapExtensionsInitializer extends Disposable {
18-
private readonly storageFilePath: string;
1918

2019
constructor(
2120
@INativeEnvironmentService private readonly environmentService: INativeEnvironmentService,
@@ -26,19 +25,19 @@ export class PositronBootstrapExtensionsInitializer extends Disposable {
2625
) {
2726
super();
2827

29-
this.storageFilePath = join(this.getVSIXPath().fsPath, '.version');
28+
const storageFilePath = join(this.environmentService.extensionsPath, '.version');
3029
const currentVersion = this.productService.positronVersion;
3130

32-
const lastKnownVersion = existsSync(this.storageFilePath) ? readFileSync(this.storageFilePath, 'utf8').trim() : '';
31+
const lastKnownVersion = existsSync(storageFilePath) ? readFileSync(storageFilePath, 'utf8').trim() : '';
3332

3433
if (lastKnownVersion !== currentVersion) {
3534
this.logService.info('First launch after first install, upgrade, or downgrade. Installing bootstrapped extensions');
3635
this.installVSIXOnStartup()
3736
.then(() => {
3837
try {
39-
writeFileSync(this.storageFilePath, currentVersion);
38+
writeFileSync(storageFilePath, currentVersion);
4039
} catch (error) {
41-
this.logService.error('Error writing bootstrapped extension storage file', this.storageFilePath, getErrorMessage(error));
40+
this.logService.error('Error writing bootstrapped extension storage file', storageFilePath, getErrorMessage(error));
4241
}
4342
})
4443
.catch(error => {

0 commit comments

Comments
 (0)