1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

[Gallery] Added platform dependent separator for cross platform compatibility (#285)

Added platform dependent separator for cross platform compatibility.
This commit is contained in:
Hemant Kumar
2020-01-28 20:09:52 +05:30
committed by Per Classon
parent b891c7cc77
commit cd7e52ab88

View File

@@ -149,8 +149,9 @@ Future<String> _startProcess(String executable,
/// Return the flutter root path from the environment variables.
String _flutterRootPath() {
final separator = (Platform.isWindows) ? ';' : ':';
final flutterBinPath =
Platform.environment['PATH'].split(':').lastWhere((setting) {
Platform.environment['PATH'].split(separator).lastWhere((setting) {
return path.canonicalize(setting).endsWith(path.join('flutter', 'bin'));
});
return Directory(flutterBinPath).parent.path;