Skip to content

Commit

Permalink
fix: handle WSL when requesting version updates (#540)
Browse files Browse the repository at this point in the history
* fix: handle Windows Subsystem for Linux platforms when requesting version updates.

* fix: lint error
  • Loading branch information
ryandagg authored Apr 10, 2023
1 parent 99197f0 commit 6072a80
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,21 +143,21 @@ export class Updater {
}

private s3ChannelManifestKey(channel: string): string {
const {bin, platform, arch} = this.config
const {bin, arch} = this.config
const s3SubDir = this.composeS3SubDir()
return path.join(s3SubDir, 'channels', channel, `${bin}-${platform}-${arch}-buildmanifest`)
return path.join(s3SubDir, 'channels', channel, `${bin}-${this.determinePlatform()}-${arch}-buildmanifest`)
}

private s3VersionManifestKey(version: string, hash: string): string {
const {bin, platform, arch} = this.config
const {bin, arch} = this.config
const s3SubDir = this.composeS3SubDir()
return path.join(s3SubDir, 'versions', version, hash, `${bin}-v${version}-${hash}-${platform}-${arch}-buildmanifest`)
return path.join(s3SubDir, 'versions', version, hash, `${bin}-v${version}-${hash}-${this.determinePlatform()}-${arch}-buildmanifest`)
}

private s3VersionIndexKey(): string {
const {bin, platform, arch} = this.config
const {bin, arch} = this.config
const s3SubDir = this.composeS3SubDir()
return path.join(s3SubDir, 'versions', `${bin}-${platform}-${arch}-tar-gz.json`)
return path.join(s3SubDir, 'versions', `${bin}-${this.determinePlatform()}-${arch}-tar-gz.json`)
}

private async fetchChannelManifest(channel: string): Promise<Interfaces.S3Manifest> {
Expand Down Expand Up @@ -197,7 +197,7 @@ export class Updater {
version,
channel,
bin: this.config.bin,
platform: this.config.platform,
platform: this.determinePlatform(),
arch: this.config.arch,
ext: 'gz',
}))
Expand All @@ -208,7 +208,7 @@ export class Updater {
version,
channel,
bin: this.config.bin,
platform: this.config.platform,
platform: this.determinePlatform(),
arch: this.config.arch,
})
const extraction = extract(stream, baseDir, output, sha256gz)
Expand Down Expand Up @@ -278,6 +278,10 @@ export class Updater {
return this.config.channel || 'stable'
}

private determinePlatform(): Interfaces.PlatformTypes {
return this.config.platform === 'wsl' ? 'linux' : this.config.platform
}

private async determineCurrentVersion(): Promise<string> {
try {
const currentVersion = await fs.readFile(this.clientBin, 'utf8')
Expand Down

0 comments on commit 6072a80

Please sign in to comment.