Skip to content

Commit

Permalink
fix(electron-updater): channel & channelFile mismatch for macOS Gener…
Browse files Browse the repository at this point in the history
…icProvider publishing (electron-userland#1203) (electron-userland#1206)
  • Loading branch information
Markus Müller authored and develar committed Feb 2, 2017
1 parent b902972 commit f23daff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/electron-updater/src/GenericProvider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Provider, FileInfo, getDefaultChannelName, getChannelFilename, getCurrentPlatform } from "./api"
import { Provider, FileInfo, getDefaultChannelName, getCustomChannelName, getChannelFilename, getCurrentPlatform } from "./api"
import { GenericServerOptions, UpdateInfo } from "electron-builder-http/out/publishOptions"
import * as url from "url"
import * as path from "path"
Expand All @@ -7,7 +7,7 @@ import { HttpError, request } from "electron-builder-http"

export class GenericProvider extends Provider<UpdateInfo> {
private readonly baseUrl = url.parse(this.configuration.url)
private readonly channel = this.configuration.channel || getDefaultChannelName()
private readonly channel = this.configuration.channel ? getCustomChannelName(this.configuration.channel) : getDefaultChannelName()

constructor(private readonly configuration: GenericServerOptions) {
super()
Expand Down
4 changes: 4 additions & 0 deletions packages/electron-updater/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export function getDefaultChannelName() {
return channel
}

export function getCustomChannelName(channel: string) {
return `${channel}${(getCurrentPlatform()) === "darwin" ? "-mac" : ""}`
}

export function getCurrentPlatform () {
return process.env.TEST_UPDATER_PLATFORM || process.platform
}
Expand Down

0 comments on commit f23daff

Please sign in to comment.