99 ReadFileContents ,
1010 ResolveGlobToPath
1111} from './utilities' ;
12+ import { satisfies } from 'semver' ;
1213
1314const logger = Logger . instance ;
1415
@@ -63,7 +64,7 @@ async function createRepositoryCfg(): Promise<void> {
6364async function getJDKPath ( editor : UnityEditor ) : Promise < string > {
6465 let jdkPath : string | undefined = undefined ;
6566
66- if ( editor . version . satisfies ( '>=2019' ) ) {
67+ if ( satisfies ( editor . version . version , '>=2019.0.0 ' ) ) {
6768 logger . info ( 'Using JDK bundled with Unity 2019+' ) ;
6869 jdkPath = await ResolveGlobToPath ( [ editor . editorRootPath , '**' , 'AndroidPlayer' , 'OpenJDK' ] ) ;
6970
@@ -87,7 +88,7 @@ async function getJDKPath(editor: UnityEditor): Promise<string> {
8788
8889async function getSdkManager ( editor : UnityEditor ) : Promise < string > {
8990 let globPath : string [ ] = [ ] ;
90- if ( editor . version . satisfies ( '>=2019' ) ) {
91+ if ( satisfies ( editor . version . version , '>=2019.0.0 ' ) ) {
9192 logger . info ( 'Using sdkmanager bundled with Unity 2019+' ) ;
9293 switch ( process . platform ) {
9394 case 'darwin' :
@@ -132,14 +133,14 @@ async function getSdkManager(editor: UnityEditor): Promise<string> {
132133 return sdkmanagerPath ;
133134}
134135
135- async function getAndroidSdkPath ( unityEditor : UnityEditor , androidTargetSdk : number ) : Promise < string | undefined > {
136- logger . ci ( `Attempting to locate Android SDK Path...\n > editorPath: ${ unityEditor . editorPath } \n > androidTargetSdk: ${ androidTargetSdk } ` ) ;
136+ async function getAndroidSdkPath ( editor : UnityEditor , androidTargetSdk : number ) : Promise < string | undefined > {
137+ logger . ci ( `Attempting to locate Android SDK Path...\n > editorPath: ${ editor . editorPath } \n > androidTargetSdk: ${ androidTargetSdk } ` ) ;
137138 let sdkPath : string ;
138139
139140 // if 2019+ test editor path, else use system android installation
140- if ( unityEditor . version . satisfies ( '>=2019' ) ) {
141+ if ( satisfies ( editor . version . version , '>=2019.0.0 ' ) ) {
141142 try {
142- sdkPath = await ResolveGlobToPath ( [ unityEditor . editorPath , '**' , 'PlaybackEngines' , 'AndroidPlayer' , 'SDK' , 'platforms' , `android-${ androidTargetSdk } /` ] ) ;
143+ sdkPath = await ResolveGlobToPath ( [ editor . editorPath , '**' , 'PlaybackEngines' , 'AndroidPlayer' , 'SDK' , 'platforms' , `android-${ androidTargetSdk } /` ] ) ;
143144 } catch ( error ) {
144145 logger . debug ( `android-${ androidTargetSdk } not installed` ) ;
145146 return undefined ;
0 commit comments