Skip to content

Commit

Permalink
If writing a file we always want Create
Browse files Browse the repository at this point in the history
This will truncate existing files.

Fixes fyne-io#1168
  • Loading branch information
andydotxyz committed Jul 7, 2020
1 parent 952478c commit b4630ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -34,6 +34,7 @@ More detailed release notes can be found on the [releases page](https://github.c
* Empty main menu causes panic (#1073)
* Installing using `fyne install` on Linux now works on distrubutions that don't use `/usr/local`
* Fix recommendations from staticcheck
* Unable to overwrite file when using dialog.ShowFileSave (#1168)


## 1.3 - 5 June 2020
Expand Down
5 changes: 1 addition & 4 deletions internal/driver/glfw/file.go
Expand Up @@ -36,10 +36,7 @@ func openFile(uri fyne.URI, create bool) (*file, error) {
}

path := uri.String()[7:]
f, err := os.Open(path)
if err != nil && create {
f, err = os.Create(path)
}
f, err := os.Create(path) // If it exists this will truncate which is what we wanted

return &file{File: f, path: path}, err
}

0 comments on commit b4630ff

Please sign in to comment.