Skip to content

Commit e99c881

Browse files
authored
Don't cache result for homeDirPath. (flutter#27873)
1 parent da5c97c commit e99c881

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

packages/flutter_tools/lib/src/base/common.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ import 'platform.dart';
77

88
/// Return the absolute path of the user's home directory
99
String get homeDirPath {
10-
if (_homeDirPath == null) {
11-
_homeDirPath = platform.isWindows
12-
? platform.environment['USERPROFILE']
13-
: platform.environment['HOME'];
14-
if (_homeDirPath != null)
15-
_homeDirPath = fs.path.absolute(_homeDirPath);
10+
String path = platform.isWindows
11+
? platform.environment['USERPROFILE']
12+
: platform.environment['HOME'];
13+
if (path != null) {
14+
path = fs.path.absolute(path);
1615
}
17-
return _homeDirPath;
16+
return path;
1817
}
19-
String _homeDirPath;
2018

2119
/// Throw a specialized exception for expected situations
2220
/// where the tool should exit with a clear message to the user

0 commit comments

Comments
 (0)