Skip to content

Commit

Permalink
Fix issue where temporary binaries would be left
Browse files Browse the repository at this point in the history
Fixes #1910
  • Loading branch information
andydotxyz committed Mar 23, 2021
1 parent b1bf77d commit 822e942
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -25,6 +25,8 @@ More detailed release notes can be found on the [releases page](https://github.c
* Add internet permission by default for Android apps (#1715)
* Child and Parent support in storage were missing for mobile appps
* Various crashes with Entry and multiline selections (including #1989)
* Slider calls OnChanged for each value between steps (#1748)
* fyne command doesn't remove temporary binary from src (#1910)


## 2.0.1 - 4 March 2021
Expand Down
9 changes: 9 additions & 0 deletions cmd/fyne/commands/package.go
Expand Up @@ -3,6 +3,7 @@ package commands
import (
"flag"
"fmt"
"log"
"strconv"
"strings"

Expand Down Expand Up @@ -105,6 +106,7 @@ func (p *packager) doPackage() error {
if !util.Exists(p.exe) {
return fmt.Errorf("unable to build directory to expected executable, %s", p.exe)
}
defer p.removeBuild()
}

switch p.os {
Expand All @@ -123,6 +125,13 @@ func (p *packager) doPackage() error {
}
}

func (p *packager) removeBuild() {
err := os.Remove(p.exe)
if err != nil {
log.Println("Unable to remove temporary build file", p.exe)
}
}

func (p *packager) validate() error {
if p.os == "" {
p.os = targetOS()
Expand Down

0 comments on commit 822e942

Please sign in to comment.