@@ -23,6 +23,7 @@ import * as path from 'node:path';
23
23
24
24
import type { Octokit } from '@octokit/rest' ;
25
25
import type * as extensionApi from '@podman-desktop/api' ;
26
+ import { env } from '@podman-desktop/api' ;
26
27
27
28
export interface MinikubeGithubReleaseArtifactMetadata {
28
29
tag : string ;
@@ -65,6 +66,14 @@ export class MinikubeDownload {
65
66
return latestReleases [ 0 ] ;
66
67
}
67
68
69
+ getMinikubeExtensionPath ( ) : string {
70
+ let fileExtension = '' ;
71
+ if ( env . isWindows ) {
72
+ fileExtension = '.exe' ;
73
+ }
74
+ return path . resolve ( this . extensionContext . storagePath , `minikube${ fileExtension } ` ) ;
75
+ }
76
+
68
77
// Download minikube from the artifact metadata: MinikubeGithubReleaseArtifactMetadata
69
78
// this will download it to the storage bin folder as well as make it executable
70
79
// return the path where the file has been downloaded
@@ -74,17 +83,12 @@ export class MinikubeDownload {
74
83
75
84
// Get the storage and check to see if it exists before we download kubectl
76
85
const storageData = this . extensionContext . storagePath ;
77
- const storageBinFolder = path . resolve ( storageData , 'bin' ) ;
78
- if ( ! existsSync ( storageBinFolder ) ) {
79
- await promises . mkdir ( storageBinFolder , { recursive : true } ) ;
86
+ if ( ! existsSync ( storageData ) ) {
87
+ await promises . mkdir ( storageData , { recursive : true } ) ;
80
88
}
81
89
82
90
// Correct the file extension and path resolution
83
- let fileExtension = '' ;
84
- if ( process . platform === 'win32' ) {
85
- fileExtension = '.exe' ;
86
- }
87
- const minikubeDownloadLocation = path . resolve ( storageBinFolder , `minikube${ fileExtension } ` ) ;
91
+ const minikubeDownloadLocation = this . getMinikubeExtensionPath ( ) ;
88
92
89
93
// Download the asset and make it executable
90
94
await this . downloadReleaseAsset ( assetId , minikubeDownloadLocation ) ;
0 commit comments