mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +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:
committed by
Per Classon
parent
b891c7cc77
commit
cd7e52ab88
@@ -149,8 +149,9 @@ Future<String> _startProcess(String executable,
|
|||||||
|
|
||||||
/// Return the flutter root path from the environment variables.
|
/// Return the flutter root path from the environment variables.
|
||||||
String _flutterRootPath() {
|
String _flutterRootPath() {
|
||||||
|
final separator = (Platform.isWindows) ? ';' : ':';
|
||||||
final flutterBinPath =
|
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 path.canonicalize(setting).endsWith(path.join('flutter', 'bin'));
|
||||||
});
|
});
|
||||||
return Directory(flutterBinPath).parent.path;
|
return Directory(flutterBinPath).parent.path;
|
||||||
|
|||||||
Reference in New Issue
Block a user