forked from Elara6331/itd
Make paths absolute for firmware upgrades
This commit is contained in:
parent
8c020f792d
commit
233b0f77f0
@ -20,6 +20,7 @@ package firmware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/cheggaaa/pb/v3"
|
||||
@ -62,7 +63,7 @@ var upgradeCmd = &cobra.Command{
|
||||
return
|
||||
}
|
||||
|
||||
progress, err := client.FirmwareUpgrade(upgType, files...)
|
||||
progress, err := client.FirmwareUpgrade(upgType, abs(files)...)
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Error initiating DFU")
|
||||
}
|
||||
@ -90,6 +91,17 @@ var upgradeCmd = &cobra.Command{
|
||||
},
|
||||
}
|
||||
|
||||
func abs(paths []string) []string {
|
||||
for index, path := range paths {
|
||||
newPath, err := filepath.Abs(path)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
paths[index] = newPath
|
||||
}
|
||||
return paths
|
||||
}
|
||||
|
||||
func init() {
|
||||
firmwareCmd.AddCommand(upgradeCmd)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user