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