Unverified Commit e99c881f authored by KyleWong's avatar KyleWong Committed by GitHub

Don't cache result for homeDirPath. (#27873)

parent da5c97c3
...@@ -7,16 +7,14 @@ import 'platform.dart'; ...@@ -7,16 +7,14 @@ import 'platform.dart';
/// Return the absolute path of the user's home directory /// Return the absolute path of the user's home directory
String get homeDirPath { String get homeDirPath {
if (_homeDirPath == null) { String path = platform.isWindows
_homeDirPath = platform.isWindows
? platform.environment['USERPROFILE'] ? platform.environment['USERPROFILE']
: platform.environment['HOME']; : platform.environment['HOME'];
if (_homeDirPath != null) if (path != null) {
_homeDirPath = fs.path.absolute(_homeDirPath); path = fs.path.absolute(path);
} }
return _homeDirPath; return path;
} }
String _homeDirPath;
/// Throw a specialized exception for expected situations /// Throw a specialized exception for expected situations
/// where the tool should exit with a clear message to the user /// where the tool should exit with a clear message to the user
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment