Make paths absolute for firmware upgrades
This commit is contained in:
parent
c019d7523b
commit
27aabdceba
@ -20,6 +20,7 @@ package firmware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cheggaaa/pb/v3"
|
"github.com/cheggaaa/pb/v3"
|
||||||
@ -62,7 +63,7 @@ var upgradeCmd = &cobra.Command{
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
progress, err := client.FirmwareUpgrade(upgType, files...)
|
progress, err := client.FirmwareUpgrade(upgType, abs(files)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("Error initiating DFU")
|
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() {
|
func init() {
|
||||||
firmwareCmd.AddCommand(upgradeCmd)
|
firmwareCmd.AddCommand(upgradeCmd)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user