Skip to content

Commit

Permalink
core tool buildDesktop detects presence of a cmd directory and builds…
Browse files Browse the repository at this point in the history
… in there. Fixes #1381
  • Loading branch information
rcoreilly committed Dec 18, 2024
1 parent 80c6bef commit b09ad07
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/core/cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,21 @@ func buildDesktop(c *config.Config, platform config.Platform) error {
}
}
ldflags += " " + config.LinkerFlags(c)

inCmd := false
fi, err := os.Stat("cmd")
if err == nil && fi.IsDir() {
os.Chdir("cmd")
inCmd = true
}

args = append(args, "-ldflags", ldflags, "-o", filepath.Join(c.Build.Output, output))

err := xc.Run("go", args...)
err = xc.Run("go", args...)
if inCmd {
os.Rename(output, filepath.Join("..", output))
os.Chdir("../")
}
if err != nil {
return fmt.Errorf("error building for platform %s/%s: %w", platform.OS, platform.Arch, err)
}
Expand Down

0 comments on commit b09ad07

Please sign in to comment.