Skip to content

Commit 2ccbd62

Browse files
committed
2.2.2: add fallback strategy if fw path is empty
1 parent 5e38b04 commit 2ccbd62

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

main.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var (
3434
rtos_compliance_offset = flag.Int("rtos_fw_pos", 0, "RTOS FW ID offset")
3535
)
3636

37-
const Version = "2.2.1"
37+
const Version = "2.2.2"
3838

3939
const dfu_flags = "-d,8087:0ABA"
4040
const rtos_firmware = "quark.bin"
@@ -201,7 +201,14 @@ func main_load() {
201201
}
202202
}
203203

204-
firmwarePath := *core
204+
firmwarePath, _ := os.Executable()
205+
firmwarePath = filepath.Join(filepath.Dir(firmwarePath), "firmwares")
206+
207+
if stat, err := os.Stat(*core); err == nil && stat.IsDir() {
208+
firmwarePath = *core
209+
} else {
210+
firmwarePath = filepath.Join(firmwarePath, *core)
211+
}
205212

206213
if needUpdateBLE || *force == true {
207214

0 commit comments

Comments
 (0)