Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/soft-doors-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-bin": minor
---

feat: adding env var for "dirname" to mirror the logic in electron-builder
19 changes: 18 additions & 1 deletion pkg/download/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func DownloadWinCodeSign() (string, error) {

func downloadFromGithub(name string, version string, checksum string) (string, error) {
id := name + "-" + version
return DownloadArtifact(id, GetGithubBaseUrl()+id+"/"+id+".7z", checksum)
return DownloadArtifact(id, GetGithubBaseUrl()+GetGithubReleaseUrl(id)+"/"+id+".7z", checksum)
}

func GetGithubBaseUrl() string {
Expand All @@ -80,6 +80,23 @@ func GetGithubBaseUrl() string {
return v
}

func GetGithubReleaseUrl(defaultName string) string {
v := os.Getenv("NPM_CONFIG_ELECTRON_BUILDER_BINARIES_CUSTOM_DIR")
if len(v) == 0 {
v = os.Getenv("npm_config_electron_builder_binaries_custom_dir")
}
if len(v) == 0 {
v = os.Getenv("npm_package_config_electron_builder_binaries_custom_dir")
}
if len(v) == 0 {
v = os.Getenv("ELECTRON_BUILDER_BINARIES_CUSTOM_DIR")
}
if len(v) == 0 {
v = defaultName
}
return v
}

func DownloadTool(descriptor ToolDescriptor, osName util.OsName) (string, error) {
arch := runtime.GOARCH
switch arch {
Expand Down
Loading