@@ -51,7 +51,7 @@ type Release struct {
5151type DownloadConfirmCB func (target string ) (bool , error )
5252
5353func DownloadAndExtract (client * Client , targetVersion string , upgradeConfirmCb DownloadConfirmCB , forceYes bool , tempDir string ) (* paths.Path , string , error ) {
54- tmpZip , version , err := DownloadImage (client , targetVersion , upgradeConfirmCb , forceYes , tempDir )
54+ tmpZip , version , err := DownloadImage (client , targetVersion , upgradeConfirmCb , forceYes , tempDir , nil )
5555 if err != nil {
5656 return nil , "" , fmt .Errorf ("error downloading the image: %v" , err )
5757 }
@@ -73,7 +73,7 @@ func DownloadAndExtract(client *Client, targetVersion string, upgradeConfirmCb D
7373 return imagePath , version , nil
7474}
7575
76- func DownloadImage (client * Client , targetVersion string , upgradeConfirmCb DownloadConfirmCB , forceYes bool , tempDir string ) (* paths.Path , string , error ) {
76+ func DownloadImage (client * Client , targetVersion string , upgradeConfirmCb DownloadConfirmCB , forceYes bool , tempDir string , downloadPath * paths. Path ) (* paths.Path , string , error ) {
7777 var err error
7878
7979 feedback .Print (i18n .Tr ("Checking for Debian image releases" ))
@@ -116,12 +116,14 @@ func DownloadImage(client *Client, targetVersion string, upgradeConfirmCb Downlo
116116 defer download .Close ()
117117
118118 // Download the zip
119- temp , err := GetTempDir ("download-" , tempDir )
120- if err != nil {
121- return nil , "" , fmt .Errorf ("could not create temporary download directory: %w" , err )
119+ if downloadPath == nil {
120+ downloadPath , err = GetTempDir ("download-" , tempDir )
121+ if err != nil {
122+ return nil , "" , fmt .Errorf ("could not create temporary download directory: %w" , err )
123+ }
122124 }
123125
124- tmpZip := temp .Join ("update .tar.zst" )
126+ tmpZip := downloadPath .Join ("arduino-unoq-debian-image-" + rel . Version + " .tar.zst" )
125127 tmpZipFile , err := tmpZip .Create ()
126128 if err != nil {
127129 return nil , "" , err
0 commit comments