@@ -47,7 +47,7 @@ type Release struct {
4747type DownloadConfirmCB func (target string ) (bool , error )
4848
4949func DownloadAndExtract (client * Client , targetVersion string , upgradeConfirmCb DownloadConfirmCB , forceYes bool ) (* paths.Path , string , error ) {
50- tmpZip , version , err := DownloadImage (client , targetVersion , upgradeConfirmCb , forceYes )
50+ tmpZip , version , err := DownloadImage (client , targetVersion , upgradeConfirmCb , forceYes , nil )
5151 if err != nil {
5252 return nil , "" , fmt .Errorf ("error downloading the image: %v" , err )
5353 }
@@ -69,7 +69,7 @@ func DownloadAndExtract(client *Client, targetVersion string, upgradeConfirmCb D
6969 return imagePath , version , nil
7070}
7171
72- func DownloadImage (client * Client , targetVersion string , upgradeConfirmCb DownloadConfirmCB , forceYes bool ) (* paths.Path , string , error ) {
72+ func DownloadImage (client * Client , targetVersion string , upgradeConfirmCb DownloadConfirmCB , forceYes bool , downloadPath * paths. Path ) (* paths.Path , string , error ) {
7373 var err error
7474
7575 feedback .Print (i18n .Tr ("Checking for Debian image releases" ))
@@ -112,12 +112,14 @@ func DownloadImage(client *Client, targetVersion string, upgradeConfirmCb Downlo
112112 defer download .Close ()
113113
114114 // Download the zip
115- temp , err := GetTempDir ("download-" )
116- if err != nil {
117- return nil , "" , fmt .Errorf ("could not create temporary download directory: %w" , err )
115+ if downloadPath == nil {
116+ downloadPath , err = GetTempDir ("download-" )
117+ if err != nil {
118+ return nil , "" , fmt .Errorf ("could not create temporary download directory: %w" , err )
119+ }
118120 }
119121
120- tmpZip := temp .Join ("update .tar.zst" )
122+ tmpZip := downloadPath .Join ("arduino-unoq-debian-image-" + rel . Version + " .tar.zst" )
121123 tmpZipFile , err := tmpZip .Create ()
122124 if err != nil {
123125 return nil , "" , err
0 commit comments