@@ -5,32 +5,44 @@ module.exports = {
55 getAndroidStudioInfo : ( ) => {
66 let androidStudioVersion = Promise . resolve ( 'N/A' ) ;
77 if ( utils . isMacOS ) {
8- androidStudioVersion = utils
9- . run (
10- utils . generatePlistBuddyCommand (
11- path . join ( '/' , 'Applications' , 'Android\\ Studio.app' , 'Contents' , 'Info.plist' ) ,
12- [ 'CFBundleShortVersionString' , 'CFBundleVersion' ]
13- )
14- )
15- . then ( version => {
16- if ( ! version ) {
17- return utils . run (
18- utils . generatePlistBuddyCommand (
19- path . join (
20- '~' ,
21- 'Applications' ,
22- 'JetBrains\\ Toolbox' ,
23- 'Android\\ Studio.app' ,
24- 'Contents' ,
25- 'Info.plist'
26- ) ,
27- [ 'CFBundleShortVersionString' , 'CFBundleVersion' ]
28- )
29- ) ;
30- }
31- return version ;
8+ const paths = [
9+ path . join ( '/' , 'Applications' , 'Android Studio.app' , 'Contents' , 'Info.plist' ) ,
10+ path . join ( process . env . HOME , 'Applications' , 'Android Studio.app' , 'Contents' , 'Info.plist' ) ,
11+ path . join (
12+ '/' ,
13+ 'Applications' ,
14+ 'JetBrains Toolbox' ,
15+ 'Android Studio.app' ,
16+ 'Contents' ,
17+ 'Info.plist'
18+ ) ,
19+ path . join (
20+ process . env . HOME ,
21+ 'Applications' ,
22+ 'JetBrains Toolbox' ,
23+ 'Android Studio.app' ,
24+ 'Contents' ,
25+ 'Info.plist'
26+ ) ,
27+ ] ;
28+ androidStudioVersion = Promise . all (
29+ paths . map ( p => {
30+ return utils . fileExists ( p ) . then ( exists => {
31+ if ( ! exists ) {
32+ return null ;
33+ }
34+ const command = utils . generatePlistBuddyCommand ( p . replace ( / / g, '\\ ' ) , [
35+ 'CFBundleShortVersionString' ,
36+ 'CFBundleVersion' ,
37+ ] ) ;
38+ return utils . run ( command ) . then ( version => {
39+ return version . split ( '\n' ) . join ( ' ' ) ;
40+ } ) ;
41+ } ) ;
3242 } )
33- . then ( version => version . split ( '\n' ) . join ( ' ' ) ) ;
43+ ) . then ( versions => {
44+ return versions . find ( version => version !== null ) || utils . NotFound ;
45+ } ) ;
3446 } else if ( utils . isLinux ) {
3547 androidStudioVersion = Promise . all ( [
3648 utils
0 commit comments