flutter create: don't use relative paths in IDEA config files (#9414)

When invoked from the command line, relative paths aren't typically
used, but they are when invoked from within IDEA and prevents
IDEA from reading the files.

Also, remove flutterPackagesDirectory since it's not used
This commit is contained in:
Brian Slesinsky 2017-04-16 13:58:08 -07:00 committed by GitHub
parent a0369806f2
commit cc3b91479c

View File

@ -192,7 +192,6 @@ Host platform code is in the android/ and ios/ directories under $relativePlugin
String projectDescription, String dirPath, String flutterRoot,
{ bool renderDriverTest: false, bool withPluginHook: false }) {
flutterRoot = fs.path.normalize(flutterRoot);
flutterRoot = _relativePath(from: dirPath, to: flutterRoot);
final String pluginDartClass = _createPluginClassName(projectName);
final String pluginClass = pluginDartClass.endsWith('Plugin')
@ -205,7 +204,6 @@ Host platform code is in the android/ and ios/ directories under $relativePlugin
'iosIdentifier': _createUTIIdentifier(projectName),
'description': projectDescription,
'dartSdk': '$flutterRoot/bin/cache/dart-sdk',
'flutterPackagesDirectory': fs.path.join(flutterRoot, 'packages'),
'androidMinApiLevel': android.minApiLevel,
'androidSdkVersion': android_sdk.minimumAndroidSdkVersion,
'androidFlutterJar': "$flutterRoot/bin/cache/artifacts/engine/android-arm/flutter.jar",
@ -300,11 +298,3 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) {
return null;
}
String _relativePath({ String from, String to }) {
final String result = fs.path.relative(to, from: from);
// `fs.path.relative()` doesn't always return a correct result: dart-lang/path#12.
if (fs.isDirectorySync(fs.path.join(from, result)))
return result;
return to;
}