Skip to content

Commit 9ddd61a

Browse files
Change helper function name
1 parent a320fba commit 9ddd61a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

updater/download_image.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func DownloadImage(client *Client, targetVersion string, upgradeConfirmCb Downlo
117117

118118
// Download the zip
119119
if downloadPath == nil {
120-
downloadPath, err = GetTempDir("download-", tempDir)
120+
downloadPath, err = SetTempDir("download-", tempDir)
121121
if err != nil {
122122
return nil, "", fmt.Errorf("could not create temporary download directory: %w", err)
123123
}
@@ -170,9 +170,10 @@ func ExtractImage(archive, temp *paths.Path) error {
170170
return nil
171171
}
172172

173-
// GetTempDir returns a temporary directory inside the user's cache directory.
173+
// SetTempDir returns a temporary directory inside the user's cache directory (default).
174+
// The tempDir parameter is used to change the download/extraction directory.
174175
// The caller is responsible for removing the directory when no longer needed.
175-
func GetTempDir(prefix string, tempDir string) (*paths.Path, error) {
176+
func SetTempDir(prefix string, tempDir string) (*paths.Path, error) {
176177
cacheDir := paths.New(tempDir)
177178

178179
if cacheDir == nil {

updater/flasher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func Flash(ctx context.Context, imagePath *paths.Path, version string, forceYes
5959
version = v
6060
imagePath = tempImagePath
6161
} else if !imagePath.IsDir() {
62-
temp, err := GetTempDir("extract-", tempDir)
62+
temp, err := SetTempDir("extract-", tempDir)
6363
if err != nil {
6464
return fmt.Errorf("error creating a temporary directory to extract the archive: %v", err)
6565
}

0 commit comments

Comments
 (0)