Skip to content

Commit

Permalink
Improve flash performance, update Yarn.
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Oct 25, 2022
1 parent 851ac43 commit 7485935
Show file tree
Hide file tree
Showing 6 changed files with 810 additions and 794 deletions.
786 changes: 0 additions & 786 deletions .yarn/releases/yarn-3.2.1.cjs

This file was deleted.

801 changes: 801 additions & 0 deletions .yarn/releases/yarn-3.2.4.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarnPath: .yarn/releases/yarn-3.2.1.cjs
yarnPath: .yarn/releases/yarn-3.2.4.cjs
11 changes: 6 additions & 5 deletions flash.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func FlashFileToBlockDevice(iff string, of string) {
fileStat, err := file.Stat()
if err != nil {
log.Fatalln("An error occurred while opening the file.", err)
} else if !fileStat.Mode().IsRegular() {
log.Fatalln("The specified file is not a regular file!")
} else if fileStat.Mode().IsDir() {
log.Fatalln("The specified source file is a folder!")
}
dest, err := os.OpenFile(destPath, os.O_WRONLY, os.ModePerm) // os.O_RDWR|os.O_EXCL|os.O_CREATE
if err != nil {
Expand All @@ -91,17 +91,17 @@ func FlashFileToBlockDevice(iff string, of string) {
timer := time.NewTimer(time.Second)
startTime := time.Now().UnixMilli()
var total int
buf := make([]byte, bs)
for {
data := make([]byte, bs)
n1, err := file.Read(data)
n1, err := file.Read(buf)
if err != nil {
if io.EOF == err {
break
} else {
log.Fatalln("Encountered error while reading file!", err)
}
}
n2, err := dest.Write(data[0:n1])
n2, err := dest.Write(buf[:n1])
if err != nil {
log.Fatalln("Encountered error while writing to dest!", err)
} else if n2 != n1 {
Expand All @@ -119,6 +119,7 @@ func FlashFileToBlockDevice(iff string, of string) {
timer.Reset(time.Second)
}
}
// t, _ := io.CopyBuffer(dest, file, buf); total = int(t)
err = dest.Sync()
if err != nil {
log.Fatalln("Failed to sync writes to disk!", err)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"build:launcher": "go build -tags launcher -ldflags=\"-s -w\" -o launcher.exe -v launcher_windows.go",
"build:js": "parcel build ui/index.tsx"
},
"packageManager": "[email protected].1",
"packageManager": "[email protected].4",
"dependencies": {
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5610,7 +5610,7 @@ resolve@^2.0.0-next.3:

"typescript@patch:typescript@^4.7.4#~builtin<compat/typescript>":
version: 4.7.4
resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=7ad353"
resolution: "typescript@patch:typescript@npm%3A4.7.4#~builtin<compat/typescript>::version=4.7.4&hash=701156"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
Expand Down

0 comments on commit 7485935

Please sign in to comment.