Ensure distribution state exists when installing distribution release

This commit is contained in:
Koen Vlaswinkel
2024-10-15 10:48:47 +02:00
parent f76100bcc1
commit c284f2158b

View File

@@ -317,6 +317,10 @@ class ExtensionSpecificDistributionManager {
} }
public async initialize() { public async initialize() {
await this.ensureDistributionStateExists();
}
private async ensureDistributionStateExists() {
const distributionStatePath = this.getDistributionStatePath(); const distributionStatePath = this.getDistributionStatePath();
try { try {
this.distributionState = await readJson(distributionStatePath); this.distributionState = await readJson(distributionStatePath);
@@ -414,6 +418,10 @@ class ExtensionSpecificDistributionManager {
release: Release, release: Release,
progressCallback?: ProgressCallback, progressCallback?: ProgressCallback,
): Promise<void> { ): Promise<void> {
if (!this.distributionState) {
await this.ensureDistributionStateExists();
}
const distributionStatePath = this.getDistributionStatePath(); const distributionStatePath = this.getDistributionStatePath();
await withDistributionUpdateLock( await withDistributionUpdateLock(