Skip to content

Commit 4f2c02a

Browse files
committed
Fixes
1 parent d252341 commit 4f2c02a

5 files changed

Lines changed: 28 additions & 20 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ ultupdater.exe
33
venv
44
test
55
.idea
6-
./*.exe
6+
./*.exe
7+
bundle.go

FyneApp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Website = "https://flashpointarchive.org"
55
Name = "Flashpoint Ultimate Updater"
66
ID = "com.flashpointarchive.ultimate-updater"
77
Version = "1.0.0"
8-
Build = 3
8+
Build = 5

downloader.go

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"context"
55
"database/sql"
6-
"encoding/binary"
76
"encoding/hex"
87
"fmt"
98
"fyne.io/fyne/v2/dialog"
@@ -14,7 +13,6 @@ import (
1413
"path/filepath"
1514
"sync"
1615
"time"
17-
"unsafe"
1816
)
1917

2018
type Update struct {
@@ -202,6 +200,7 @@ func (d *Downloader) Resume() error {
202200
dest := filepath.Join(d.installPath, dir)
203201
err = os.MkdirAll(dest, os.ModePerm)
204202
if err != nil {
203+
// Illegal folder on windows?
205204
dialog.NewError(&FatalDownloadFailure{err}, d.state.window).Show()
206205
return
207206
}
@@ -417,9 +416,18 @@ func (d *Downloader) Resume() error {
417416
} else {
418417
req, err := d.NewRequest(f)
419418
if err != nil {
420-
dialog.NewError(err, d.state.window).Show()
419+
// Send failure (bad parsing)
420+
d.updatech <- &Update{
421+
IndexFile: f,
422+
Progress: 0,
423+
Bytes: 0,
424+
Done: true,
425+
Retry: false,
426+
Failure: &FatalDownloadFailure{err},
427+
}
428+
} else {
429+
d.reqch <- req
421430
}
422-
d.reqch <- req
423431
}
424432
}
425433
}
@@ -472,11 +480,19 @@ func (d *Downloader) Resume() error {
472480
for _, f := range files {
473481
req, err := d.NewRequest(f)
474482
if err != nil {
475-
return err
483+
// Send failure (bad parsing)
484+
d.updatech <- &Update{
485+
IndexFile: f,
486+
Progress: 0,
487+
Bytes: 0,
488+
Done: true,
489+
Retry: false,
490+
Failure: &FatalDownloadFailure{err},
491+
}
492+
} else {
493+
// Add request to queue
494+
d.reqch <- req
476495
}
477-
478-
// Add request to queue
479-
d.reqch <- req
480496
}
481497
d.running = true
482498
_ = d.state.runningLabel.Set("Running")
@@ -535,9 +551,3 @@ func (d *Downloader) NewRequest(f *IndexedFile) (*grab.Request, error) {
535551

536552
return req, nil
537553
}
538-
539-
func intToBytes(n int) []byte {
540-
bytes := make([]byte, unsafe.Sizeof(n)) // Assuming int is 4 bytes on your platform
541-
binary.BigEndian.PutUint32(bytes, uint32(n))
542-
return bytes
543-
}

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ go 1.20
55
require (
66
fyne.io/fyne/v2 v2.3.5
77
github.com/cavaliergopher/grab/v3 v3.0.1
8+
github.com/dustin/go-humanize v1.0.1
89
github.com/mattn/go-sqlite3 v1.14.17
910
)
1011

1112
require (
1213
fyne.io/systray v1.10.1-0.20230602210930-b6a2d6ca2a7b // indirect
1314
github.com/davecgh/go-spew v1.1.1 // indirect
14-
github.com/dustin/go-humanize v1.0.1 // indirect
1515
github.com/fredbi/uri v0.1.0 // indirect
1616
github.com/fsnotify/fsnotify v1.5.4 // indirect
1717
github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect
@@ -35,7 +35,6 @@ require (
3535
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
3636
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
3737
golang.org/x/text v0.6.0 // indirect
38-
golang.org/x/time v0.3.0 // indirect
3938
gopkg.in/yaml.v3 v3.0.1 // indirect
4039
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect
4140
)

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,6 @@ golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
489489
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
490490
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
491491
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
492-
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
493-
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
494492
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
495493
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
496494
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=

0 commit comments

Comments
 (0)