Flutter doctor detect IntelliJ on Mac (#6262)

* cleanup obtaining user home directory path
* refactor doctor and detect IntelliJ on Mac
* fix detect Flutter plugin for IntelliJ
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index 49201a3..4b18195 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -10,6 +10,7 @@
 import 'package:path/path.dart' as path;
 
 import '../application_package.dart';
+import '../base/common.dart';
 import '../base/context.dart';
 import '../base/process.dart';
 import '../build_info.dart';
@@ -318,7 +319,7 @@
   String get xcrunPath => path.join('/usr', 'bin', 'xcrun');
 
   String _getSimulatorPath() {
-    return path.join(homeDirectory, 'Library', 'Developer', 'CoreSimulator', 'Devices', id);
+    return path.join(homeDirPath, 'Library', 'Developer', 'CoreSimulator', 'Devices', id);
   }
 
   String _getSimulatorAppHomeDirectory(ApplicationPackage app) {
@@ -544,7 +545,7 @@
   }
 
   String get logFilePath {
-    return path.join(homeDirectory, 'Library', 'Logs', 'CoreSimulator', id, 'system.log');
+    return path.join(homeDirPath, 'Library', 'Logs', 'CoreSimulator', id, 'system.log');
   }
 
   @override
@@ -587,7 +588,6 @@
 
   @override
   Future<bool> takeScreenshot(File outputFile) async {
-    String homeDirPath = Platform.environment['HOME'] ?? Platform.environment['USERPROFILE'];
     Directory desktopDir = new Directory(path.join(homeDirPath, 'Desktop'));
 
     // 'Simulator Screen Shot Mar 25, 2016, 2.59.43 PM.png'