diff --git a/.all-contributorsrc b/.all-contributorsrc index 9d28ad5..52af55c 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -130,6 +130,15 @@ "bug", "code" ] + }, + { + "login": "Nthalk", + "name": "Carl Taylor", + "avatar_url": "https://avatars.githubusercontent.com/u/174297?v=4", + "profile": "https://github.com/Nthalk", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index 42c6444..7de9eaf 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

[![npm version](https://badge.fury.io/js/envinfo.svg)](https://badge.fury.io/js/envinfo) [![npm downloads per month](https://img.shields.io/npm/dm/envinfo.svg?maxAge=86400)](https://www.npmjs.com/package/envinfo) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![All Contributors](https://img.shields.io/badge/all_contributors-11-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors) ## The problem @@ -280,7 +280,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds | [
Trevor Brindle](http://trevorbrindle.com)
[πŸ’¬](#question-tabrindle "Answering Questions") [πŸ“](#blog-tabrindle "Blogposts") [πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Atabrindle "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=tabrindle "Code") [πŸ“–](https://github.com/tabrindle/envinfo/commits?author=tabrindle "Documentation") [πŸ’‘](#example-tabrindle "Examples") [πŸ€”](#ideas-tabrindle "Ideas, Planning, & Feedback") [πŸ‘€](#review-tabrindle "Reviewed Pull Requests") [πŸ“’](#talk-tabrindle "Talks") [⚠️](https://github.com/tabrindle/envinfo/commits?author=tabrindle "Tests") | [
Gant Laborde](http://gantlaborde.com/)
[πŸ“](#blog-GantMan "Blogposts") [πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3AGantMan "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=GantMan "Code") [πŸ€”](#ideas-GantMan "Ideas, Planning, & Feedback") | [
Anton Fisher](http://antonfisher.com)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Aantonfisher "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=antonfisher "Code") | [
Ahmad Awais ⚑️](https://AhmadAwais.com/)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Aahmadawais "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=ahmadawais "Code") | [
Hasan](https://github.com/LEQADA)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3ALEQADA "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=LEQADA "Code") | [
Ernesto RamΓ­rez](http://twitter.com/_ErnestoR)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3AErnestoR "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=ErnestoR "Code") | [
Jiawen Geng](https://www.gengjiawen.com)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Agengjiawen "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=gengjiawen "Code") [πŸ€”](#ideas-gengjiawen "Ideas, Planning, & Feedback") [⚠️](https://github.com/tabrindle/envinfo/commits?author=gengjiawen "Tests") | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | -| [
Zac Anger](https://zacanger.com)
[πŸ’»](https://github.com/tabrindle/envinfo/commits?author=zacanger "Code") [πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Azacanger "Bug reports") | [
Ville Immonen](https://twitter.com/VilleImmonen)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Afson "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=fson "Code") | [
Olmo Maldonado](http://ibolmo.com)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Aibolmo "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=ibolmo "Code") | [
Rishabh Chawla](https://rishabhchawla.co)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Arishabh3112 "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=rishabh3112 "Code") | +| [
Zac Anger](https://zacanger.com)
[πŸ’»](https://github.com/tabrindle/envinfo/commits?author=zacanger "Code") [πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Azacanger "Bug reports") | [
Ville Immonen](https://twitter.com/VilleImmonen)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Afson "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=fson "Code") | [
Olmo Maldonado](http://ibolmo.com)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Aibolmo "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=ibolmo "Code") | [
Rishabh Chawla](https://rishabhchawla.co)
[πŸ›](https://github.com/tabrindle/envinfo/issues?q=author%3Arishabh3112 "Bug reports") [πŸ’»](https://github.com/tabrindle/envinfo/commits?author=rishabh3112 "Code") | [
Carl Taylor](https://github.com/Nthalk)
[πŸ’»](https://github.com/tabrindle/envinfo/commits?author=Nthalk "Code") | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! diff --git a/src/helpers/ides.js b/src/helpers/ides.js index d0af50d..28a6c31 100644 --- a/src/helpers/ides.js +++ b/src/helpers/ides.js @@ -5,32 +5,44 @@ module.exports = { getAndroidStudioInfo: () => { let androidStudioVersion = Promise.resolve('N/A'); if (utils.isMacOS) { - androidStudioVersion = utils - .run( - utils.generatePlistBuddyCommand( - path.join('/', 'Applications', 'Android\\ Studio.app', 'Contents', 'Info.plist'), - ['CFBundleShortVersionString', 'CFBundleVersion'] - ) - ) - .then(version => { - if (!version) { - return utils.run( - utils.generatePlistBuddyCommand( - path.join( - '~', - 'Applications', - 'JetBrains\\ Toolbox', - 'Android\\ Studio.app', - 'Contents', - 'Info.plist' - ), - ['CFBundleShortVersionString', 'CFBundleVersion'] - ) - ); - } - return version; + const paths = [ + path.join('/', 'Applications', 'Android Studio.app', 'Contents', 'Info.plist'), + path.join(process.env.HOME, 'Applications', 'Android Studio.app', 'Contents', 'Info.plist'), + path.join( + '/', + 'Applications', + 'JetBrains Toolbox', + 'Android Studio.app', + 'Contents', + 'Info.plist' + ), + path.join( + process.env.HOME, + 'Applications', + 'JetBrains Toolbox', + 'Android Studio.app', + 'Contents', + 'Info.plist' + ), + ]; + androidStudioVersion = Promise.all( + paths.map(p => { + return utils.fileExists(p).then(exists => { + if (!exists) { + return null; + } + const command = utils.generatePlistBuddyCommand(p.replace(/ /g, '\\ '), [ + 'CFBundleShortVersionString', + 'CFBundleVersion', + ]); + return utils.run(command).then(version => { + return version.split('\n').join(' '); + }); + }); }) - .then(version => version.split('\n').join(' ')); + ).then(versions => { + return versions.find(version => version !== null) || utils.NotFound; + }); } else if (utils.isLinux) { androidStudioVersion = Promise.all([ utils