Ban package:path from Flutter Tools (#8119)
diff --git a/packages/flutter_tools/lib/src/android/android_sdk.dart b/packages/flutter_tools/lib/src/android/android_sdk.dart
index 55164af..ac5d5d6 100644
--- a/packages/flutter_tools/lib/src/android/android_sdk.dart
+++ b/packages/flutter_tools/lib/src/android/android_sdk.dart
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
import 'package:pub_semver/pub_semver.dart';
import '../base/common.dart';
@@ -69,20 +68,20 @@
androidHomeDir = platform.environment[kAndroidHome];
} else if (platform.isLinux) {
if (homeDirPath != null)
- androidHomeDir = path.join(homeDirPath, 'Android', 'Sdk');
+ androidHomeDir = fs.path.join(homeDirPath, 'Android', 'Sdk');
} else if (platform.isMacOS) {
if (homeDirPath != null)
- androidHomeDir = path.join(homeDirPath, 'Library', 'Android', 'sdk');
+ androidHomeDir = fs.path.join(homeDirPath, 'Library', 'Android', 'sdk');
} else if (platform.isWindows) {
if (homeDirPath != null)
- androidHomeDir = path.join(homeDirPath, 'AppData', 'Local', 'Android', 'sdk');
+ androidHomeDir = fs.path.join(homeDirPath, 'AppData', 'Local', 'Android', 'sdk');
}
if (androidHomeDir != null) {
if (validSdkDirectory(androidHomeDir))
return new AndroidSdk(androidHomeDir);
- if (validSdkDirectory(path.join(androidHomeDir, 'sdk')))
- return new AndroidSdk(path.join(androidHomeDir, 'sdk'));
+ if (validSdkDirectory(fs.path.join(androidHomeDir, 'sdk')))
+ return new AndroidSdk(fs.path.join(androidHomeDir, 'sdk'));
}
File aaptBin = os.which('aapt'); // in build-tools/$version/aapt
@@ -109,7 +108,7 @@
}
static bool validSdkDirectory(String dir) {
- return fs.isDirectorySync(path.join(dir, 'platform-tools'));
+ return fs.isDirectorySync(fs.path.join(dir, 'platform-tools'));
}
List<AndroidSdkVersion> get sdkVersions => _sdkVersions;
@@ -131,30 +130,30 @@
}
String getPlatformToolsPath(String binaryName) {
- return path.join(directory, 'platform-tools', binaryName);
+ return fs.path.join(directory, 'platform-tools', binaryName);
}
void _init() {
List<String> platforms = <String>[]; // android-22, ...
- Directory platformsDir = fs.directory(path.join(directory, 'platforms'));
+ Directory platformsDir = fs.directory(fs.path.join(directory, 'platforms'));
if (platformsDir.existsSync()) {
platforms = platformsDir
.listSync()
- .map((FileSystemEntity entity) => path.basename(entity.path))
+ .map((FileSystemEntity entity) => fs.path.basename(entity.path))
.where((String name) => name.startsWith('android-'))
.toList();
}
List<Version> buildTools = <Version>[]; // 19.1.0, 22.0.1, ...
- Directory buildToolsDir = fs.directory(path.join(directory, 'build-tools'));
+ Directory buildToolsDir = fs.directory(fs.path.join(directory, 'build-tools'));
if (buildToolsDir.existsSync()) {
buildTools = buildToolsDir
.listSync()
.map((FileSystemEntity entity) {
try {
- return new Version.parse(path.basename(entity.path));
+ return new Version.parse(fs.path.basename(entity.path));
} catch (error) {
return null;
}
@@ -243,11 +242,11 @@
}
String getPlatformsPath(String itemName) {
- return path.join(sdk.directory, 'platforms', platformVersionName, itemName);
+ return fs.path.join(sdk.directory, 'platforms', platformVersionName, itemName);
}
String getBuildToolsPath(String binaryName) {
- return path.join(sdk.directory, 'build-tools', buildToolsVersionName, binaryName);
+ return fs.path.join(sdk.directory, 'build-tools', buildToolsVersionName, binaryName);
}
@override
diff --git a/packages/flutter_tools/lib/src/android/gradle.dart b/packages/flutter_tools/lib/src/android/gradle.dart
index 4e2d941..b9035bb 100644
--- a/packages/flutter_tools/lib/src/android/gradle.dart
+++ b/packages/flutter_tools/lib/src/android/gradle.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
@@ -83,7 +81,7 @@
if (gradleDir != null) {
if (fs.isFileSync(gradleDir))
return gradleDir;
- return path.join(gradleDir, 'bin', 'gradle');
+ return fs.path.join(gradleDir, 'bin', 'gradle');
}
// Look relative to Android Studio.
@@ -98,14 +96,14 @@
if (studioPath != null) {
// '/Applications/Android Studio.app/Contents/gradle/gradle-2.10/bin/gradle'
if (os.isMacOS && !studioPath.endsWith('Contents'))
- studioPath = path.join(studioPath, 'Contents');
+ studioPath = fs.path.join(studioPath, 'Contents');
- Directory dir = fs.directory(path.join(studioPath, 'gradle'));
+ Directory dir = fs.directory(fs.path.join(studioPath, 'gradle'));
if (dir.existsSync()) {
// We find the first valid gradle directory.
for (FileSystemEntity entity in dir.listSync()) {
- if (entity is Directory && path.basename(entity.path).startsWith('gradle-')) {
- String executable = path.join(entity.path, 'bin', 'gradle');
+ if (entity is Directory && fs.path.basename(entity.path).startsWith('gradle-')) {
+ String executable = fs.path.join(entity.path, 'bin', 'gradle');
if (fs.isFileSync(executable))
return executable;
}
diff --git a/packages/flutter_tools/lib/src/application_package.dart b/packages/flutter_tools/lib/src/application_package.dart
index 564beb6..b5dc498 100644
--- a/packages/flutter_tools/lib/src/application_package.dart
+++ b/packages/flutter_tools/lib/src/application_package.dart
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
import 'package:xml/xml.dart' as xml;
import 'android/android_sdk.dart';
@@ -86,8 +85,8 @@
manifestPath = gradleManifestPath;
apkPath = gradleAppOut;
} else {
- manifestPath = path.join('android', 'AndroidManifest.xml');
- apkPath = path.join(getAndroidBuildDirectory(), 'app.apk');
+ manifestPath = fs.path.join('android', 'AndroidManifest.xml');
+ apkPath = fs.path.join(getAndroidBuildDirectory(), 'app.apk');
}
if (!fs.isFileSync(manifestPath))
@@ -125,7 +124,7 @@
String get packagePath => apkPath;
@override
- String get name => path.basename(apkPath);
+ String get name => fs.path.basename(apkPath);
}
/// Tests whether a [FileSystemEntity] is an iOS bundle directory
@@ -142,14 +141,14 @@
Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_app_');
addShutdownHook(() async => await tempDir.delete(recursive: true));
os.unzip(fs.file(applicationBinary), tempDir);
- Directory payloadDir = fs.directory(path.join(tempDir.path, 'Payload'));
+ Directory payloadDir = fs.directory(fs.path.join(tempDir.path, 'Payload'));
bundleDir = payloadDir.listSync().singleWhere(_isBundleDirectory);
} on StateError catch (e, stackTrace) {
printError('Invalid prebuilt iOS binary: ${e.toString()}', stackTrace);
return null;
}
- String plistPath = path.join(bundleDir.path, 'Info.plist');
+ String plistPath = fs.path.join(bundleDir.path, 'Info.plist');
String id = plist.getValueFromFile(plistPath, plist.kCFBundleIdentifierKey);
if (id == null)
return null;
@@ -157,7 +156,7 @@
return new PrebuiltIOSApp(
ipaPath: applicationBinary,
bundleDir: bundleDir,
- bundleName: path.basename(bundleDir.path),
+ bundleName: fs.path.basename(bundleDir.path),
projectBundleId: id,
);
}
@@ -166,15 +165,15 @@
if (getCurrentHostPlatform() != HostPlatform.darwin_x64)
return null;
- String plistPath = path.join('ios', 'Runner', 'Info.plist');
+ String plistPath = fs.path.join('ios', 'Runner', 'Info.plist');
String id = plist.getValueFromFile(plistPath, plist.kCFBundleIdentifierKey);
if (id == null)
return null;
- String projectPath = path.join('ios', 'Runner.xcodeproj');
+ String projectPath = fs.path.join('ios', 'Runner.xcodeproj');
id = substituteXcodeVariables(id, projectPath, 'Runner');
return new BuildableIOSApp(
- appDirectory: path.join('ios'),
+ appDirectory: fs.path.join('ios'),
projectBundleId: id
);
}
@@ -207,7 +206,7 @@
String get deviceBundlePath => _buildAppPath('iphoneos');
String _buildAppPath(String type) {
- return path.join(getIosBuildDirectory(), 'Release-$type', kBundleName);
+ return fs.path.join(getIosBuildDirectory(), 'Release-$type', kBundleName);
}
}
diff --git a/packages/flutter_tools/lib/src/asset.dart b/packages/flutter_tools/lib/src/asset.dart
index 39bfbec..5c265ab 100644
--- a/packages/flutter_tools/lib/src/asset.dart
+++ b/packages/flutter_tools/lib/src/asset.dart
@@ -6,7 +6,6 @@
import 'dart:convert';
import 'package:json_schema/json_schema.dart';
-import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';
import 'base/file_system.dart';
@@ -46,7 +45,7 @@
for (String asset in assets) {
if (asset == '')
continue;
- final String assetPath = path.join(projectRoot, asset);
+ final String assetPath = fs.path.join(projectRoot, asset);
final String archivePath = asset;
entries[archivePath] = new DevFSFileContent(fs.file(assetPath));
}
@@ -74,7 +73,7 @@
bool reportLicensedPackages: false
}) async {
workingDirPath ??= getAssetBuildDirectory();
- packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
+ packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath);
Object manifest;
try {
manifest = _loadFlutterManifest(manifestPath);
@@ -95,7 +94,7 @@
}
Map<String, dynamic> manifestDescriptor = manifest;
manifestDescriptor = manifestDescriptor['flutter'] ?? <String, dynamic>{};
- String assetBasePath = path.dirname(path.absolute(manifestPath));
+ String assetBasePath = fs.path.dirname(fs.path.absolute(manifestPath));
_lastBuildTimestamp = new DateTime.now();
@@ -193,7 +192,7 @@
}
Map<String, dynamic> _readMaterialFontsManifest() {
- String fontsPath = path.join(path.absolute(Cache.flutterRoot),
+ String fontsPath = fs.path.join(fs.path.absolute(Cache.flutterRoot),
'packages', 'flutter_tools', 'schema', 'material_fonts.yaml');
return loadYaml(fs.file(fontsPath).readAsStringSync());
@@ -212,8 +211,8 @@
for (Map<String, dynamic> font in family['fonts']) {
String assetKey = font['asset'];
result.add(new _Asset(
- base: path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'),
- source: path.basename(assetKey),
+ base: fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'artifacts', 'material_fonts'),
+ source: fs.path.basename(assetKey),
relativePath: assetKey
));
}
@@ -338,7 +337,7 @@
return result;
excludeDirs = excludeDirs.map(
- (String exclude) => path.absolute(exclude) + fs.path.separator).toList();
+ (String exclude) => fs.path.absolute(exclude) + fs.path.separator).toList();
if (manifestDescriptor.containsKey('assets')) {
for (String asset in manifestDescriptor['assets']) {
@@ -354,8 +353,8 @@
// Find asset variants
String assetPath = baseAsset.assetFile.path;
- String assetFilename = path.basename(assetPath);
- Directory assetDir = fs.directory(path.dirname(assetPath));
+ String assetFilename = fs.path.basename(assetPath);
+ Directory assetDir = fs.directory(fs.path.dirname(assetPath));
List<FileSystemEntity> files = assetDir.listSync(recursive: true);
@@ -367,11 +366,11 @@
if (excludeDirs.any((String exclude) => entity.path.startsWith(exclude)))
continue;
- if (path.basename(entity.path) == assetFilename && entity.path != assetPath) {
- String key = path.relative(entity.path, from: baseAsset.base);
+ if (fs.path.basename(entity.path) == assetFilename && entity.path != assetPath) {
+ String key = fs.path.relative(entity.path, from: baseAsset.base);
String assetEntry;
if (baseAsset.symbolicPrefix != null)
- assetEntry = path.join(baseAsset.symbolicPrefix, key);
+ assetEntry = fs.path.join(baseAsset.symbolicPrefix, key);
variants.add(new _Asset(base: baseAsset.base, assetEntry: assetEntry, relativePath: key));
}
}
@@ -407,7 +406,7 @@
String assetBase,
String asset
) {
- if (asset.startsWith('packages/') && !fs.isFileSync(path.join(assetBase, asset))) {
+ if (asset.startsWith('packages/') && !fs.isFileSync(fs.path.join(assetBase, asset))) {
// Convert packages/flutter_gallery_assets/clouds-0.png to clouds-0.png.
String packageKey = asset.substring(9);
String relativeAsset = asset;
@@ -436,9 +435,9 @@
}
Future<int> _validateFlutterManifest(Object manifest) async {
- String schemaPath = path.join(path.absolute(Cache.flutterRoot),
+ String schemaPath = fs.path.join(fs.path.absolute(Cache.flutterRoot),
'packages', 'flutter_tools', 'schema', 'pubspec_yaml.json');
- Schema schema = await Schema.createSchemaFromUrl(path.toUri(schemaPath).toString());
+ Schema schema = await Schema.createSchemaFromUrl(fs.path.toUri(schemaPath).toString());
Validator validator = new Validator(schema);
if (validator.validate(manifest)) {
diff --git a/packages/flutter_tools/lib/src/base/common.dart b/packages/flutter_tools/lib/src/base/common.dart
index 6c7eca2..e764e65 100644
--- a/packages/flutter_tools/lib/src/base/common.dart
+++ b/packages/flutter_tools/lib/src/base/common.dart
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
-
+import 'file_system.dart';
import 'platform.dart';
const int kDefaultObservatoryPort = 8100;
@@ -16,7 +15,7 @@
? platform.environment['USERPROFILE']
: platform.environment['HOME'];
if (_homeDirPath != null)
- _homeDirPath = path.absolute(_homeDirPath);
+ _homeDirPath = fs.path.absolute(_homeDirPath);
}
return _homeDirPath;
}
diff --git a/packages/flutter_tools/lib/src/base/config.dart b/packages/flutter_tools/lib/src/base/config.dart
index fb975a1..7d38c2e 100644
--- a/packages/flutter_tools/lib/src/base/config.dart
+++ b/packages/flutter_tools/lib/src/base/config.dart
@@ -4,15 +4,13 @@
import 'dart:convert';
-import 'package:path/path.dart' as path;
-
import 'context.dart';
import 'file_system.dart';
import 'platform.dart';
class Config {
Config([File configFile]) {
- _configFile = configFile ?? fs.file(path.join(_userHomeDir(), '.flutter_settings'));
+ _configFile = configFile ?? fs.file(fs.path.join(_userHomeDir(), '.flutter_settings'));
if (_configFile.existsSync())
_values = JSON.decode(_configFile.readAsStringSync());
}
diff --git a/packages/flutter_tools/lib/src/base/file_system.dart b/packages/flutter_tools/lib/src/base/file_system.dart
index e95eefe..4d295f0 100644
--- a/packages/flutter_tools/lib/src/base/file_system.dart
+++ b/packages/flutter_tools/lib/src/base/file_system.dart
@@ -6,7 +6,7 @@
import 'package:file/local.dart';
import 'package:file/memory.dart';
import 'package:file/record_replay.dart';
-import 'package:path/path.dart' as path;
+
import 'common.dart' show throwToolExit;
import 'context.dart';
@@ -56,7 +56,7 @@
/// Create the ancestor directories of a file path if they do not already exist.
void ensureDirectoryExists(String filePath) {
- String dirPath = path.dirname(filePath);
+ String dirPath = fs.path.dirname(filePath);
if (fs.isDirectorySync(dirPath))
return;
try {
@@ -77,7 +77,7 @@
destDir.createSync(recursive: true);
srcDir.listSync().forEach((FileSystemEntity entity) {
- String newPath = path.join(destDir.path, path.basename(entity.path));
+ String newPath = fs.path.join(destDir.path, fs.path.basename(entity.path));
if (entity is File) {
File newFile = destDir.fileSystem.file(newPath);
newFile.writeAsBytesSync(entity.readAsBytesSync());
diff --git a/packages/flutter_tools/lib/src/base/os.dart b/packages/flutter_tools/lib/src/base/os.dart
index 8c21a4c..82fa562 100644
--- a/packages/flutter_tools/lib/src/base/os.dart
+++ b/packages/flutter_tools/lib/src/base/os.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'package:archive/archive.dart';
-import 'package:path/path.dart' as path;
import 'context.dart';
import 'file_system.dart';
@@ -106,7 +105,7 @@
if (!archiveFile.isFile || archiveFile.name.endsWith('/'))
continue;
- File destFile = fs.file(path.join(targetDirectory.path, archiveFile.name));
+ File destFile = fs.file(fs.path.join(targetDirectory.path, archiveFile.name));
if (!destFile.parent.existsSync())
destFile.parent.createSync(recursive: true);
destFile.writeAsBytesSync(archiveFile.content);
@@ -162,9 +161,9 @@
const String kProjectRootSentinel = 'pubspec.yaml';
directory ??= fs.currentDirectory.path;
while (true) {
- if (fs.isFileSync(path.join(directory, kProjectRootSentinel)))
+ if (fs.isFileSync(fs.path.join(directory, kProjectRootSentinel)))
return directory;
- String parent = path.dirname(directory);
+ String parent = fs.path.dirname(directory);
if (directory == parent) return null;
directory = parent;
}
diff --git a/packages/flutter_tools/lib/src/base/utils.dart b/packages/flutter_tools/lib/src/base/utils.dart
index 805d6a9..7fe223b 100644
--- a/packages/flutter_tools/lib/src/base/utils.dart
+++ b/packages/flutter_tools/lib/src/base/utils.dart
@@ -7,7 +7,6 @@
import 'dart:math' show Random;
import 'package:crypto/crypto.dart';
-import 'package:path/path.dart' as path;
import 'file_system.dart';
import 'platform.dart';
@@ -66,7 +65,7 @@
while (true) {
String name = '${baseName}_${i.toString().padLeft(2, '0')}.$ext';
- File file = fs.file(path.join(dir.path, name));
+ File file = fs.file(fs.path.join(dir.path, name));
if (!file.existsSync())
return file;
i++;
diff --git a/packages/flutter_tools/lib/src/build_info.dart b/packages/flutter_tools/lib/src/build_info.dart
index 76af121..2b3e697 100644
--- a/packages/flutter_tools/lib/src/build_info.dart
+++ b/packages/flutter_tools/lib/src/build_info.dart
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
-
import 'base/context.dart';
+import 'base/file_system.dart';
import 'base/platform.dart';
import 'base/utils.dart';
import 'globals.dart';
@@ -129,7 +128,7 @@
return 'build';
String buildDir = config.getValue('build-dir') ?? 'build';
- if (path.isAbsolute(buildDir)) {
+ if (fs.path.isAbsolute(buildDir)) {
throw new Exception(
'build-dir config setting in ${config.configPath} must be relative');
}
@@ -144,15 +143,15 @@
/// Returns the AOT build output directory.
String getAotBuildDirectory() {
- return path.join(getBuildDirectory(), 'aot');
+ return fs.path.join(getBuildDirectory(), 'aot');
}
/// Returns the asset build output directory.
String getAssetBuildDirectory() {
- return path.join(getBuildDirectory(), 'flx');
+ return fs.path.join(getBuildDirectory(), 'flx');
}
/// Returns the iOS build output directory.
String getIosBuildDirectory() {
- return path.join(getBuildDirectory(), 'ios');
+ return fs.path.join(getBuildDirectory(), 'ios');
}
diff --git a/packages/flutter_tools/lib/src/cache.dart b/packages/flutter_tools/lib/src/cache.dart
index 66726129..7b44074 100644
--- a/packages/flutter_tools/lib/src/cache.dart
+++ b/packages/flutter_tools/lib/src/cache.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import 'base/context.dart';
import 'base/file_system.dart';
import 'base/logger.dart';
@@ -52,7 +50,7 @@
if (!_lockEnabled)
return null;
assert(_lock == null);
- _lock = fs.file(path.join(flutterRoot, 'bin', 'cache', 'lockfile')).openSync(mode: FileMode.WRITE);
+ _lock = fs.file(fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile')).openSync(mode: FileMode.WRITE);
bool locked = false;
bool printed = false;
while (!locked) {
@@ -91,7 +89,7 @@
static String get engineRevision {
if (_engineRevision == null) {
- File revisionFile = fs.file(path.join(flutterRoot, 'bin', 'internal', 'engine.version'));
+ File revisionFile = fs.file(fs.path.join(flutterRoot, 'bin', 'internal', 'engine.version'));
if (revisionFile.existsSync())
_engineRevision = revisionFile.readAsStringSync().trim();
}
@@ -103,14 +101,14 @@
/// Return the top-level directory in the cache; this is `bin/cache`.
Directory getRoot() {
if (_rootOverride != null)
- return fs.directory(path.join(_rootOverride.path, 'bin', 'cache'));
+ return fs.directory(fs.path.join(_rootOverride.path, 'bin', 'cache'));
else
- return fs.directory(path.join(flutterRoot, 'bin', 'cache'));
+ return fs.directory(fs.path.join(flutterRoot, 'bin', 'cache'));
}
/// Return a directory in the cache dir. For `pkg`, this will return `bin/cache/pkg`.
Directory getCacheDir(String name) {
- Directory dir = fs.directory(path.join(getRoot().path, name));
+ Directory dir = fs.directory(fs.path.join(getRoot().path, name));
if (!dir.existsSync())
dir.createSync(recursive: true);
return dir;
@@ -122,11 +120,11 @@
/// Get a named directory from with the cache's artifact directory; for example,
/// `material_fonts` would return `bin/cache/artifacts/material_fonts`.
Directory getArtifactDirectory(String name) {
- return fs.directory(path.join(getCacheArtifacts().path, name));
+ return fs.directory(fs.path.join(getCacheArtifacts().path, name));
}
String getVersionFor(String artifactName) {
- File versionFile = fs.file(path.join(_rootOverride?.path ?? flutterRoot, 'bin', 'internal', '$artifactName.version'));
+ File versionFile = fs.file(fs.path.join(_rootOverride?.path ?? flutterRoot, 'bin', 'internal', '$artifactName.version'));
return versionFile.existsSync() ? versionFile.readAsStringSync().trim() : null;
}
@@ -140,7 +138,7 @@
}
File getStampFileFor(String artifactName) {
- return fs.file(path.join(getRoot().path, '$artifactName.stamp'));
+ return fs.file(fs.path.join(getRoot().path, '$artifactName.stamp'));
}
bool isUpToDate() {
@@ -156,11 +154,11 @@
Uri url = Uri.parse(urlStr);
Directory thirdPartyDir = getArtifactDirectory('third_party');
- Directory serviceDir = fs.directory(path.join(thirdPartyDir.path, serviceName));
+ Directory serviceDir = fs.directory(fs.path.join(thirdPartyDir.path, serviceName));
if (!serviceDir.existsSync())
serviceDir.createSync(recursive: true);
- File cachedFile = fs.file(path.join(serviceDir.path, url.pathSegments.last));
+ File cachedFile = fs.file(fs.path.join(serviceDir.path, url.pathSegments.last));
if (!cachedFile.existsSync()) {
try {
await _downloadFileToCache(url, cachedFile, unzip);
@@ -197,7 +195,7 @@
if (location is Directory && !location.existsSync())
location.createSync(recursive: true);
- File tempFile = fs.file(path.join(fs.systemTempDirectory.path, '${url.toString().hashCode}.zip'));
+ File tempFile = fs.file(fs.path.join(fs.systemTempDirectory.path, '${url.toString().hashCode}.zip'));
tempFile.writeAsBytesSync(fileBytes, flush: true);
os.unzip(tempFile, location);
tempFile.deleteSync();
@@ -311,14 +309,14 @@
bool isUpToDate() {
Directory pkgDir = cache.getCacheDir('pkg');
for (String pkgName in _getPackageDirs()) {
- String pkgPath = path.join(pkgDir.path, pkgName);
+ String pkgPath = fs.path.join(pkgDir.path, pkgName);
if (!fs.directory(pkgPath).existsSync())
return false;
}
Directory engineDir = cache.getArtifactDirectory(kName);
for (List<String> toolsDir in _getBinaryDirs()) {
- Directory dir = fs.directory(path.join(engineDir.path, toolsDir[0]));
+ Directory dir = fs.directory(fs.path.join(engineDir.path, toolsDir[0]));
if (!dir.existsSync())
return false;
}
@@ -332,7 +330,7 @@
Directory pkgDir = cache.getCacheDir('pkg');
for (String pkgName in _getPackageDirs()) {
- String pkgPath = path.join(pkgDir.path, pkgName);
+ String pkgPath = fs.path.join(pkgDir.path, pkgName);
Directory dir = fs.directory(pkgPath);
if (dir.existsSync())
dir.deleteSync(recursive: true);
@@ -346,14 +344,14 @@
for (List<String> toolsDir in _getBinaryDirs()) {
String cacheDir = toolsDir[0];
String urlPath = toolsDir[1];
- Directory dir = fs.directory(path.join(engineDir.path, cacheDir));
+ Directory dir = fs.directory(fs.path.join(engineDir.path, cacheDir));
await _downloadItem('Downloading $cacheDir tools...', url + urlPath, dir);
_makeFilesExecutable(dir);
- File frameworkZip = fs.file(path.join(dir.path, 'Flutter.framework.zip'));
+ File frameworkZip = fs.file(fs.path.join(dir.path, 'Flutter.framework.zip'));
if (frameworkZip.existsSync()) {
- Directory framework = fs.directory(path.join(dir.path, 'Flutter.framework'));
+ Directory framework = fs.directory(fs.path.join(dir.path, 'Flutter.framework'));
framework.createSync();
os.unzip(frameworkZip, framework);
}
@@ -365,7 +363,7 @@
void _makeFilesExecutable(Directory dir) {
for (FileSystemEntity entity in dir.listSync()) {
if (entity is File) {
- String name = path.basename(entity.path);
+ String name = fs.path.basename(entity.path);
if (name == 'sky_snapshot' || name == 'sky_shell')
os.makeExecutable(entity);
}
diff --git a/packages/flutter_tools/lib/src/commands/analyze_base.dart b/packages/flutter_tools/lib/src/commands/analyze_base.dart
index 8d2c3fa..c31d0cb 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_base.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_base.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'package:args/args.dart';
-import 'package:path/path.dart' as path;
import '../base/file_system.dart';
import '../base/utils.dart';
@@ -56,11 +55,11 @@
/// If [fileList] is empty, then return `true` if the current directory resides inside the Flutter repository.
bool inRepo(List<String> fileList) {
if (fileList == null || fileList.isEmpty)
- fileList = <String>[path.current];
- String root = path.normalize(path.absolute(Cache.flutterRoot));
+ fileList = <String>[fs.path.current];
+ String root = fs.path.normalize(fs.path.absolute(Cache.flutterRoot));
String prefix = root + fs.path.separator;
for (String file in fileList) {
- file = path.normalize(path.absolute(file));
+ file = fs.path.normalize(fs.path.absolute(file));
if (file == root || file.startsWith(prefix))
return true;
}
diff --git a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
index 581afda..daccb39 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_continuously.dart
@@ -6,7 +6,6 @@
import 'dart:convert';
import 'package:args/args.dart';
-import 'package:path/path.dart' as path;
import '../base/common.dart';
import '../base/file_system.dart';
@@ -41,7 +40,7 @@
analysisTarget = 'Flutter repository';
printTrace('Analyzing Flutter repository:');
for (String projectPath in directories)
- printTrace(' ${path.relative(projectPath)}');
+ printTrace(' ${fs.path.relative(projectPath)}');
} else {
directories = <String>[fs.currentDirectory.path];
analysisTarget = fs.currentDirectory.path;
@@ -157,9 +156,9 @@
int _id = 0;
Future<Null> start() async {
- String snapshot = path.join(sdk, 'bin/snapshots/analysis_server.dart.snapshot');
+ String snapshot = fs.path.join(sdk, 'bin/snapshots/analysis_server.dart.snapshot');
List<String> command = <String>[
- path.join(dartSdkPath, 'bin', 'dart'),
+ fs.path.join(dartSdkPath, 'bin', 'dart'),
snapshot,
'--sdk',
sdk,
@@ -309,7 +308,7 @@
@override
String toString() {
- String relativePath = path.relative(file);
+ String relativePath = fs.path.relative(file);
return '${severity.toLowerCase().padLeft(7)} • $message • $relativePath:$startLine:$startColumn';
}
diff --git a/packages/flutter_tools/lib/src/commands/analyze_once.dart b/packages/flutter_tools/lib/src/commands/analyze_once.dart
index 846156c..f0a8c50 100644
--- a/packages/flutter_tools/lib/src/commands/analyze_once.dart
+++ b/packages/flutter_tools/lib/src/commands/analyze_once.dart
@@ -6,7 +6,6 @@
import 'dart:collection';
import 'package:args/args.dart';
-import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart' as yaml;
import '../base/common.dart';
@@ -34,12 +33,12 @@
List<File> dartFiles = <File>[];
for (String file in argResults.rest.toList()) {
- file = path.normalize(path.absolute(file));
- String root = path.rootPrefix(file);
+ file = fs.path.normalize(fs.path.absolute(file));
+ String root = fs.path.rootPrefix(file);
dartFiles.add(fs.file(file));
while (file != root) {
- file = path.dirname(file);
- if (fs.isFileSync(path.join(file, 'pubspec.yaml'))) {
+ file = fs.path.dirname(file);
+ if (fs.isFileSync(fs.path.join(file, 'pubspec.yaml'))) {
pubSpecDirectories.add(fs.directory(file));
break;
}
@@ -83,7 +82,7 @@
// determine what all the various .packages files depend on
PackageDependencyTracker dependencies = new PackageDependencyTracker();
for (Directory directory in pubSpecDirectories) {
- String pubSpecYamlPath = path.join(directory.path, 'pubspec.yaml');
+ String pubSpecYamlPath = fs.path.join(directory.path, 'pubspec.yaml');
File pubSpecYamlFile = fs.file(pubSpecYamlPath);
if (pubSpecYamlFile.existsSync()) {
// we are analyzing the actual canonical source for this package;
@@ -91,10 +90,10 @@
// pointing elsewhere somehow.
yaml.YamlMap pubSpecYaml = yaml.loadYaml(fs.file(pubSpecYamlPath).readAsStringSync());
String packageName = pubSpecYaml['name'];
- String packagePath = path.normalize(path.absolute(path.join(directory.path, 'lib')));
+ String packagePath = fs.path.normalize(fs.path.absolute(fs.path.join(directory.path, 'lib')));
dependencies.addCanonicalCase(packageName, packagePath, pubSpecYamlPath);
}
- String dotPackagesPath = path.join(directory.path, '.packages');
+ String dotPackagesPath = fs.path.join(directory.path, '.packages');
File dotPackages = fs.file(dotPackagesPath);
if (dotPackages.existsSync()) {
// this directory has opinions about what we should be using
@@ -106,12 +105,12 @@
int colon = line.indexOf(':');
if (colon > 0) {
String packageName = line.substring(0, colon);
- String packagePath = path.fromUri(line.substring(colon+1));
- // Ensure that we only add the `analyzer` package defined in the vended SDK (and referred to with a local path directive).
+ String packagePath = fs.path.fromUri(line.substring(colon+1));
+ // Ensure that we only add the `analyzer` package defined in the vended SDK (and referred to with a local fs.path. directive).
// Analyzer package versions reached via transitive dependencies (e.g., via `test`) are ignored since they would produce
// spurious conflicts.
if (packageName != 'analyzer' || packagePath.startsWith('..'))
- dependencies.add(packageName, path.normalize(path.absolute(directory.path, packagePath)), dotPackagesPath);
+ dependencies.add(packageName, fs.path.normalize(fs.path.absolute(directory.path, packagePath)), dotPackagesPath);
}
});
}
@@ -138,7 +137,7 @@
if (argResults['preamble']) {
if (dartFiles.length == 1) {
- logger.printStatus('Analyzing ${path.relative(dartFiles.first.path)}...');
+ logger.printStatus('Analyzing ${fs.path.relative(dartFiles.first.path)}...');
} else {
logger.printStatus('Analyzing ${dartFiles.length} files...');
}
@@ -147,8 +146,8 @@
options.dartSdkPath = argResults['dart-sdk'];
options.packageMap = packages;
options.analysisOptionsFile = flutterRepo
- ? path.join(Cache.flutterRoot, '.analysis_options_repo')
- : path.join(Cache.flutterRoot, 'packages', 'flutter', 'lib', 'analysis_options_user.yaml');
+ ? fs.path.join(Cache.flutterRoot, '.analysis_options_repo')
+ : fs.path.join(Cache.flutterRoot, 'packages', 'flutter', 'lib', 'analysis_options_user.yaml');
AnalysisDriver analyzer = new AnalysisDriver(options);
// TODO(pq): consider error handling
@@ -200,8 +199,8 @@
List<String> flutterRootComponents;
bool isFlutterLibrary(String filename) {
- flutterRootComponents ??= path.normalize(path.absolute(Cache.flutterRoot)).split(path.separator);
- List<String> filenameComponents = path.normalize(path.absolute(filename)).split(path.separator);
+ flutterRootComponents ??= fs.path.normalize(fs.path.absolute(Cache.flutterRoot)).split(fs.path.separator);
+ List<String> filenameComponents = fs.path.normalize(fs.path.absolute(filename)).split(fs.path.separator);
if (filenameComponents.length < flutterRootComponents.length + 4) // the 4: 'packages', package_name, 'lib', file_name
return false;
for (int index = 0; index < flutterRootComponents.length; index += 1) {
@@ -219,14 +218,14 @@
List<File> _collectDartFiles(Directory dir, List<File> collected) {
// Bail out in case of a .dartignore.
- if (fs.isFileSync(path.join(dir.path, '.dartignore')))
+ if (fs.isFileSync(fs.path.join(dir.path, '.dartignore')))
return collected;
for (FileSystemEntity entity in dir.listSync(recursive: false, followLinks: false)) {
if (isDartFile(entity))
collected.add(entity);
if (entity is Directory) {
- String name = path.basename(entity.path);
+ String name = fs.path.basename(entity.path);
if (!name.startsWith('.') && name != 'packages')
_collectDartFiles(entity, collected);
}
@@ -251,11 +250,11 @@
}
bool get hasConflict => values.length > 1;
bool get hasConflictAffectingFlutterRepo {
- assert(path.isAbsolute(Cache.flutterRoot));
+ assert(fs.path.isAbsolute(Cache.flutterRoot));
for (List<String> targetSources in values.values) {
for (String source in targetSources) {
- assert(path.isAbsolute(source));
- if (path.isWithin(Cache.flutterRoot, source))
+ assert(fs.path.isAbsolute(source));
+ if (fs.path.isWithin(Cache.flutterRoot, source))
return true;
}
}
diff --git a/packages/flutter_tools/lib/src/commands/build_aot.dart b/packages/flutter_tools/lib/src/commands/build_aot.dart
index 5ef7e34..17c1d89 100644
--- a/packages/flutter_tools/lib/src/commands/build_aot.dart
+++ b/packages/flutter_tools/lib/src/commands/build_aot.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
@@ -51,7 +49,7 @@
if (platform == null)
throwToolExit('Unknown platform: $targetPlatform');
- String typeName = path.basename(tools.getEngineArtifactsDirectory(platform, getBuildMode()).path);
+ String typeName = fs.path.basename(tools.getEngineArtifactsDirectory(platform, getBuildMode()).path);
Status status = logger.startProgress('Building AOT snapshot in ${getModeName(getBuildMode())} mode ($typeName)...',
expectSlowOperation: true);
String outputPath = await buildAotSnapshot(
@@ -71,7 +69,7 @@
}
String _getSdkExtensionPath(PackageMap packageMap, String package) {
- return path.dirname(packageMap.map[package].toFilePath());
+ return fs.path.dirname(packageMap.map[package].toFilePath());
}
/// Build an AOT snapshot. Return `null` (and log to `printError`) if the method
@@ -122,15 +120,15 @@
String engineSrc = tools.engineSrcPath;
String genSnapshotExecutable = 'gen_snapshot';
if (engineSrc != null) {
- entryPointsDir = path.join(engineSrc, 'flutter', 'runtime');
- dartEntryPointsDir = path.join(engineSrc, 'dart', 'runtime', 'bin');
- snapshotterDir = path.join(engineSrc, 'flutter', 'lib', 'snapshot');
+ entryPointsDir = fs.path.join(engineSrc, 'flutter', 'runtime');
+ dartEntryPointsDir = fs.path.join(engineSrc, 'dart', 'runtime', 'bin');
+ snapshotterDir = fs.path.join(engineSrc, 'flutter', 'lib', 'snapshot');
String engineOut = tools.getEngineArtifactsDirectory(platform, buildMode).path;
if (platform == TargetPlatform.ios) {
- genSnapshot = path.join(engineOut, 'clang_x64', genSnapshotExecutable);
+ genSnapshot = fs.path.join(engineOut, 'clang_x64', genSnapshotExecutable);
} else {
String host32BitToolchain = getCurrentHostPlatform() == HostPlatform.darwin_x64 ? 'clang_i386' : 'clang_x86';
- genSnapshot = path.join(engineOut, host32BitToolchain, genSnapshotExecutable);
+ genSnapshot = fs.path.join(engineOut, host32BitToolchain, genSnapshotExecutable);
}
} else {
String artifactsDir = tools.getEngineArtifactsDirectory(platform, buildMode).path;
@@ -138,22 +136,22 @@
dartEntryPointsDir = entryPointsDir;
snapshotterDir = entryPointsDir;
if (platform == TargetPlatform.ios) {
- genSnapshot = path.join(artifactsDir, genSnapshotExecutable);
+ genSnapshot = fs.path.join(artifactsDir, genSnapshotExecutable);
} else {
- String hostToolsDir = path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform()));
- genSnapshot = path.join(hostToolsDir, genSnapshotExecutable);
+ String hostToolsDir = fs.path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform()));
+ genSnapshot = fs.path.join(hostToolsDir, genSnapshotExecutable);
}
}
Directory outputDir = fs.directory(outputPath);
outputDir.createSync(recursive: true);
- String vmSnapshotData = path.join(outputDir.path, 'vm_snapshot_data');
- String vmSnapshotInstructions = path.join(outputDir.path, 'vm_snapshot_instr');
- String isolateSnapshotData = path.join(outputDir.path, 'isolate_snapshot_data');
- String isolateSnapshotInstructions = path.join(outputDir.path, 'isolate_snapshot_instr');
+ String vmSnapshotData = fs.path.join(outputDir.path, 'vm_snapshot_data');
+ String vmSnapshotInstructions = fs.path.join(outputDir.path, 'vm_snapshot_instr');
+ String isolateSnapshotData = fs.path.join(outputDir.path, 'isolate_snapshot_data');
+ String isolateSnapshotInstructions = fs.path.join(outputDir.path, 'isolate_snapshot_instr');
- String vmEntryPoints = path.join(entryPointsDir, 'dart_vm_entry_points.txt');
- String ioEntryPoints = path.join(dartEntryPointsDir, 'dart_io_entries.txt');
+ String vmEntryPoints = fs.path.join(entryPointsDir, 'dart_vm_entry_points.txt');
+ String ioEntryPoints = fs.path.join(dartEntryPointsDir, 'dart_io_entries.txt');
PackageMap packageMap = new PackageMap(PackageMap.globalPackagesPath);
String packageMapError = packageMap.checkValid();
@@ -163,9 +161,9 @@
}
String skyEnginePkg = _getSdkExtensionPath(packageMap, 'sky_engine');
- String uiPath = path.join(skyEnginePkg, 'dart_ui', 'ui.dart');
- String jniPath = path.join(skyEnginePkg, 'dart_jni', 'jni.dart');
- String vmServicePath = path.join(skyEnginePkg, 'sdk_ext', 'vmservice_io.dart');
+ String uiPath = fs.path.join(skyEnginePkg, 'dart_ui', 'ui.dart');
+ String jniPath = fs.path.join(skyEnginePkg, 'dart_jni', 'jni.dart');
+ String vmServicePath = fs.path.join(skyEnginePkg, 'sdk_ext', 'vmservice_io.dart');
List<String> filePaths = <String>[
vmEntryPoints,
@@ -186,14 +184,14 @@
case TargetPlatform.android_arm:
case TargetPlatform.android_x64:
case TargetPlatform.android_x86:
- vmEntryPointsAndroid = path.join(entryPointsDir, 'dart_vm_entry_points_android.txt');
+ vmEntryPointsAndroid = fs.path.join(entryPointsDir, 'dart_vm_entry_points_android.txt');
filePaths.addAll(<String>[
vmEntryPointsAndroid,
]);
break;
case TargetPlatform.ios:
- snapshotDartIOS = path.join(snapshotterDir, 'snapshot.dart');
- assembly = path.join(outputDir.path, 'snapshot_assembly.S');
+ snapshotDartIOS = fs.path.join(snapshotterDir, 'snapshot.dart');
+ assembly = fs.path.join(outputDir.path, 'snapshot_assembly.S');
filePaths.addAll(<String>[
snapshotDartIOS,
]);
@@ -276,23 +274,23 @@
String kVmSnapshotData = 'kDartVmSnapshotData';
String kIsolateSnapshotData = 'kDartIsolateSnapshotData';
- String kVmSnapshotDataC = path.join(outputDir.path, '$kVmSnapshotData.c');
- String kIsolateSnapshotDataC = path.join(outputDir.path, '$kIsolateSnapshotData.c');
- String kVmSnapshotDataO = path.join(outputDir.path, '$kVmSnapshotData.o');
- String kIsolateSnapshotDataO = path.join(outputDir.path, '$kIsolateSnapshotData.o');
- String assemblyO = path.join(outputDir.path, 'snapshot_assembly.o');
+ String kVmSnapshotDataC = fs.path.join(outputDir.path, '$kVmSnapshotData.c');
+ String kIsolateSnapshotDataC = fs.path.join(outputDir.path, '$kIsolateSnapshotData.c');
+ String kVmSnapshotDataO = fs.path.join(outputDir.path, '$kVmSnapshotData.o');
+ String kIsolateSnapshotDataO = fs.path.join(outputDir.path, '$kIsolateSnapshotData.o');
+ String assemblyO = fs.path.join(outputDir.path, 'snapshot_assembly.o');
List<String> commonBuildOptions = <String>['-arch', 'arm64', '-miphoneos-version-min=8.0'];
if (interpreter) {
- runCheckedSync(<String>['mv', vmSnapshotData, path.join(outputDir.path, kVmSnapshotData)]);
- runCheckedSync(<String>['mv', isolateSnapshotData, path.join(outputDir.path, kIsolateSnapshotData)]);
+ runCheckedSync(<String>['mv', vmSnapshotData, fs.path.join(outputDir.path, kVmSnapshotData)]);
+ runCheckedSync(<String>['mv', isolateSnapshotData, fs.path.join(outputDir.path, kIsolateSnapshotData)]);
runCheckedSync(<String>[
- 'xxd', '--include', kVmSnapshotData, path.basename(kVmSnapshotDataC)
+ 'xxd', '--include', kVmSnapshotData, fs.path.basename(kVmSnapshotDataC)
], workingDirectory: outputDir.path);
runCheckedSync(<String>[
- 'xxd', '--include', kIsolateSnapshotData, path.basename(kIsolateSnapshotDataC)
+ 'xxd', '--include', kIsolateSnapshotData, fs.path.basename(kIsolateSnapshotDataC)
], workingDirectory: outputDir.path);
runCheckedSync(<String>['xcrun', 'cc']
@@ -307,7 +305,7 @@
..addAll(<String>['-c', assembly, '-o', assemblyO]));
}
- String appSo = path.join(outputDir.path, 'app.dylib');
+ String appSo = fs.path.join(outputDir.path, 'app.dylib');
List<String> linkCommand = <String>['xcrun', 'clang']
..addAll(commonBuildOptions)
diff --git a/packages/flutter_tools/lib/src/commands/build_apk.dart b/packages/flutter_tools/lib/src/commands/build_apk.dart
index 7007c03..19b74d4 100644
--- a/packages/flutter_tools/lib/src/commands/build_apk.dart
+++ b/packages/flutter_tools/lib/src/commands/build_apk.dart
@@ -5,8 +5,6 @@
import 'dart:async';
import 'dart:convert' show JSON;
-import 'package:path/path.dart' as path;
-
import '../android/android_sdk.dart';
import '../android/gradle.dart';
import '../base/common.dart';
@@ -39,8 +37,8 @@
// Password for the Chromium debug keystore
const String _kDebugKeystorePassword = "chromium";
-// Default APK output path.
-String get _defaultOutputPath => path.join(getAndroidBuildDirectory(), 'app.apk');
+// Default APK output fs.path.
+String get _defaultOutputPath => fs.path.join(getAndroidBuildDirectory(), 'app.apk');
/// Copies files into a new directory structure.
class _AssetBuilder {
@@ -54,7 +52,7 @@
}
void add(File asset, String relativePath) {
- String destPath = path.join(_assetDir.path, relativePath);
+ String destPath = fs.path.join(_assetDir.path, relativePath);
ensureDirectoryExists(destPath);
asset.copySync(destPath);
}
@@ -176,7 +174,7 @@
help: 'Android manifest XML file.');
argParser.addOption('resources',
abbr: 'r',
- help: 'Resources directory path.');
+ help: 'Resources directory fs.path.');
argParser.addOption('output-file',
abbr: 'o',
defaultsTo: _defaultOutputPath,
@@ -301,12 +299,12 @@
} else {
Directory artifacts = tools.getEngineArtifactsDirectory(platform, buildMode);
- components.icuData = fs.file(path.join(artifacts.path, 'icudtl.dat'));
+ components.icuData = fs.file(fs.path.join(artifacts.path, 'icudtl.dat'));
components.jars = <File>[
- fs.file(path.join(artifacts.path, 'classes.dex.jar'))
+ fs.file(fs.path.join(artifacts.path, 'classes.dex.jar'))
];
- components.libSkyShell = fs.file(path.join(artifacts.path, 'libsky_shell.so'));
- components.debugKeystore = fs.file(path.join(artifacts.path, 'chromium-debug.keystore'));
+ components.libSkyShell = fs.file(fs.path.join(artifacts.path, 'libsky_shell.so'));
+ components.debugKeystore = fs.file(fs.path.join(artifacts.path, 'chromium-debug.keystore'));
}
await parseServiceConfigs(components.services, jars: components.jars);
@@ -465,7 +463,7 @@
if (!fs.isFileSync('$apkPath.sha1'))
return true;
- String lastBuildType = _readBuildMeta(path.dirname(apkPath))['targetBuildType'];
+ String lastBuildType = _readBuildMeta(fs.path.dirname(apkPath))['targetBuildType'];
String targetBuildType = _getTargetBuildTypeToken(platform, buildMode, fs.file(apkPath));
if (lastBuildType != targetBuildType)
return true;
@@ -534,7 +532,7 @@
if (components == null)
throwToolExit('Failure building APK: unable to find components.');
- String typeName = path.basename(tools.getEngineArtifactsDirectory(platform, buildMode).path);
+ String typeName = fs.path.basename(tools.getEngineArtifactsDirectory(platform, buildMode).path);
Status status = logger.startProgress('Building APK in ${getModeName(buildMode)} mode ($typeName)...',
expectSlowOperation: true);
@@ -567,7 +565,7 @@
if (!fs.isDirectorySync(aotPath))
throwToolExit('AOT snapshot does not exist: $aotPath');
for (String aotFilename in kAotSnapshotFiles) {
- String aotFilePath = path.join(aotPath, aotFilename);
+ String aotFilePath = fs.path.join(aotPath, aotFilename);
if (!fs.isFileSync(aotFilePath))
throwToolExit('Missing AOT snapshot file: $aotFilePath');
components.extraFiles['assets/$aotFilename'] = fs.file(aotFilePath);
@@ -584,7 +582,7 @@
printTrace('Built $outputFile (${getSizeAsMB(apkFile.lengthSync())}).');
_writeBuildMetaEntry(
- path.dirname(outputFile),
+ fs.path.dirname(outputFile),
'targetBuildType',
_getTargetBuildTypeToken(platform, buildMode, fs.file(outputFile))
);
@@ -640,7 +638,7 @@
}
Map<String, dynamic> _readBuildMeta(String buildDirectoryPath) {
- File buildMetaFile = fs.file(path.join(buildDirectoryPath, 'build_meta.json'));
+ File buildMetaFile = fs.file(fs.path.join(buildDirectoryPath, 'build_meta.json'));
if (buildMetaFile.existsSync())
return JSON.decode(buildMetaFile.readAsStringSync());
return <String, dynamic>{};
@@ -649,7 +647,7 @@
void _writeBuildMetaEntry(String buildDirectoryPath, String key, dynamic value) {
Map<String, dynamic> meta = _readBuildMeta(buildDirectoryPath);
meta[key] = value;
- File buildMetaFile = fs.file(path.join(buildDirectoryPath, 'build_meta.json'));
+ File buildMetaFile = fs.file(fs.path.join(buildDirectoryPath, 'build_meta.json'));
buildMetaFile.writeAsStringSync(toPrettyJson(meta));
}
diff --git a/packages/flutter_tools/lib/src/commands/build_ios.dart b/packages/flutter_tools/lib/src/commands/build_ios.dart
index e562321..5e3fc80 100644
--- a/packages/flutter_tools/lib/src/commands/build_ios.dart
+++ b/packages/flutter_tools/lib/src/commands/build_ios.dart
@@ -4,10 +4,9 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../application_package.dart';
import '../base/common.dart';
+import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/utils.dart';
import '../build_info.dart';
@@ -64,7 +63,7 @@
String logTarget = forSimulator ? 'simulator' : 'device';
- String typeName = path.basename(tools.getEngineArtifactsDirectory(TargetPlatform.ios, getBuildMode()).path);
+ String typeName = fs.path.basename(tools.getEngineArtifactsDirectory(TargetPlatform.ios, getBuildMode()).path);
Status status = logger.startProgress('Building $app for $logTarget ($typeName)...',
expectSlowOperation: true);
XcodeBuildResult result = await buildXcodeProject(
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index 83f3e7d..4458ff9 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../android/android.dart' as android;
import '../base/common.dart';
import '../base/file_system.dart';
@@ -68,21 +66,21 @@
await Cache.instance.updateAll();
- String flutterRoot = path.absolute(Cache.flutterRoot);
+ String flutterRoot = fs.path.absolute(Cache.flutterRoot);
- String flutterPackagesDirectory = path.join(flutterRoot, 'packages');
- String flutterPackagePath = path.join(flutterPackagesDirectory, 'flutter');
- if (!fs.isFileSync(path.join(flutterPackagePath, 'pubspec.yaml')))
+ String flutterPackagesDirectory = fs.path.join(flutterRoot, 'packages');
+ String flutterPackagePath = fs.path.join(flutterPackagesDirectory, 'flutter');
+ if (!fs.isFileSync(fs.path.join(flutterPackagePath, 'pubspec.yaml')))
throwToolExit('Unable to find package:flutter in $flutterPackagePath', exitCode: 2);
- String flutterDriverPackagePath = path.join(flutterRoot, 'packages', 'flutter_driver');
- if (!fs.isFileSync(path.join(flutterDriverPackagePath, 'pubspec.yaml')))
+ String flutterDriverPackagePath = fs.path.join(flutterRoot, 'packages', 'flutter_driver');
+ if (!fs.isFileSync(fs.path.join(flutterDriverPackagePath, 'pubspec.yaml')))
throwToolExit('Unable to find package:flutter_driver in $flutterDriverPackagePath', exitCode: 2);
Directory projectDir = fs.directory(argResults.rest.first);
- String dirPath = path.normalize(projectDir.absolute.path);
- String relativePath = path.relative(dirPath);
- String projectName = _normalizeProjectName(path.basename(dirPath));
+ String dirPath = fs.path.normalize(projectDir.absolute.path);
+ String relativePath = fs.path.relative(dirPath);
+ String projectName = _normalizeProjectName(fs.path.basename(dirPath));
String error =_validateProjectDir(dirPath, flutterRoot: flutterRoot);
if (error != null)
@@ -141,10 +139,10 @@
String flutterPackagesDirectory, { bool renderDriverTest: false }) {
fs.directory(dirPath).createSync(recursive: true);
- flutterPackagesDirectory = path.normalize(flutterPackagesDirectory);
+ flutterPackagesDirectory = fs.path.normalize(flutterPackagesDirectory);
flutterPackagesDirectory = _relativePath(from: dirPath, to: flutterPackagesDirectory);
- printStatus('Creating project ${path.relative(dirPath)}...');
+ printStatus('Creating project ${fs.path.relative(dirPath)}...');
Map<String, dynamic> templateContext = <String, dynamic>{
'projectName': projectName,
@@ -168,7 +166,7 @@
if (renderDriverTest) {
Template driverTemplate = new Template.fromName('driver');
- fileCount += driverTemplate.render(fs.directory(path.join(dirPath, 'test_driver')),
+ fileCount += driverTemplate.render(fs.directory(fs.path.join(dirPath, 'test_driver')),
templateContext, overwriteExisting: false);
}
@@ -229,7 +227,7 @@
/// Return `null` if the project directory is legal. Return a validation message
/// if we should disallow the directory name.
String _validateProjectDir(String dirPath, { String flutterRoot }) {
- if (path.isWithin(flutterRoot, dirPath)) {
+ if (fs.path.isWithin(flutterRoot, dirPath)) {
return "Cannot create a project within the Flutter SDK.\n"
"Target directory '$dirPath' is within the Flutter SDK at '$flutterRoot'.";
}
@@ -251,9 +249,9 @@
}
String _relativePath({ String from, String to }) {
- String result = path.relative(to, from: from);
- // `path.relative()` doesn't always return a correct result: dart-lang/path#12.
- if (fs.isDirectorySync(path.join(from, result)))
+ 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;
}
diff --git a/packages/flutter_tools/lib/src/commands/drive.dart b/packages/flutter_tools/lib/src/commands/drive.dart
index 5e9156f..5d98854 100644
--- a/packages/flutter_tools/lib/src/commands/drive.dart
+++ b/packages/flutter_tools/lib/src/commands/drive.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../android/android_device.dart' show AndroidDevice;
import '../application_package.dart';
import '../base/file_system.dart';
@@ -140,25 +138,25 @@
}
String _getTestFile() {
- String appFile = path.normalize(targetFile);
+ String appFile = fs.path.normalize(targetFile);
// This command extends `flutter start` and therefore CWD == package dir
String packageDir = fs.currentDirectory.path;
// Make appFile path relative to package directory because we are looking
// for the corresponding test file relative to it.
- if (!path.isRelative(appFile)) {
- if (!path.isWithin(packageDir, appFile)) {
+ if (!fs.path.isRelative(appFile)) {
+ if (!fs.path.isWithin(packageDir, appFile)) {
printError(
'Application file $appFile is outside the package directory $packageDir'
);
return null;
}
- appFile = path.relative(appFile, from: packageDir);
+ appFile = fs.path.relative(appFile, from: packageDir);
}
- List<String> parts = path.split(appFile);
+ List<String> parts = fs.path.split(appFile);
if (parts.length < 2) {
printError(
@@ -171,9 +169,9 @@
// Look for the test file inside `test_driver/` matching the sub-path, e.g.
// if the application is `lib/foo/bar.dart`, the test file is expected to
// be `test_driver/foo/bar_test.dart`.
- String pathWithNoExtension = path.withoutExtension(path.joinAll(
+ String pathWithNoExtension = fs.path.withoutExtension(fs.path.joinAll(
<String>[packageDir, 'test_driver']..addAll(parts.skip(1))));
- return '${pathWithNoExtension}_test${path.extension(appFile)}';
+ return '${pathWithNoExtension}_test${fs.path.extension(appFile)}';
}
}
@@ -317,11 +315,11 @@
Future<Null> _runTests(List<String> testArgs, String observatoryUri) async {
printTrace('Running driver tests.');
- PackageMap.globalPackagesPath = path.normalize(path.absolute(PackageMap.globalPackagesPath));
+ PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath));
List<String> args = testArgs.toList()
..add('--packages=${PackageMap.globalPackagesPath}')
..add('-rexpanded');
- String dartVmPath = path.join(dartSdkPath, 'bin', 'dart');
+ String dartVmPath = fs.path.join(dartSdkPath, 'bin', 'dart');
int result = await runCommandAndStreamOutput(
<String>[dartVmPath]..addAll(args),
environment: <String, String>{ 'VM_SERVICE_URL': observatoryUri }
diff --git a/packages/flutter_tools/lib/src/commands/format.dart b/packages/flutter_tools/lib/src/commands/format.dart
index 147d009..45d8c04 100644
--- a/packages/flutter_tools/lib/src/commands/format.dart
+++ b/packages/flutter_tools/lib/src/commands/format.dart
@@ -4,9 +4,8 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../base/common.dart';
+import '../base/file_system.dart';
import '../base/process.dart';
import '../cache.dart';
import '../runner/flutter_command.dart';
@@ -37,7 +36,7 @@
);
}
- String dartfmt = path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'dartfmt');
+ String dartfmt = fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'dartfmt');
List<String> cmd = <String>[dartfmt, '-w']..addAll(argResults.rest);
int result = await runCommandAndStreamOutput(cmd);
if (result != 0)
diff --git a/packages/flutter_tools/lib/src/commands/screenshot.dart b/packages/flutter_tools/lib/src/commands/screenshot.dart
index 81b517d..9dd14b8 100644
--- a/packages/flutter_tools/lib/src/commands/screenshot.dart
+++ b/packages/flutter_tools/lib/src/commands/screenshot.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'package:http/http.dart' as http;
-import 'package:path/path.dart' as path;
import '../base/common.dart';
import '../base/file_system.dart';
@@ -139,6 +138,6 @@
Future<Null> showOutputFileInfo(File outputFile) async {
int sizeKB = (await outputFile.length()) ~/ 1024;
- printStatus('Screenshot written to ${path.relative(outputFile.path)} (${sizeKB}kB).');
+ printStatus('Screenshot written to ${fs.path.relative(outputFile.path)} (${sizeKB}kB).');
}
}
diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart
index 7178a78..a86ad2e 100644
--- a/packages/flutter_tools/lib/src/commands/test.dart
+++ b/packages/flutter_tools/lib/src/commands/test.dart
@@ -4,7 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
import 'package:test/src/executable.dart' as test; // ignore: implementation_imports
import '../base/common.dart';
@@ -69,7 +68,7 @@
return directory.listSync(recursive: true, followLinks: false)
.where((FileSystemEntity entity) => entity.path.endsWith('_test.dart') &&
fs.isFileSync(entity.path))
- .map((FileSystemEntity entity) => path.absolute(entity.path));
+ .map((FileSystemEntity entity) => fs.path.absolute(entity.path));
}
Directory get _currentPackageTestDir {
@@ -83,7 +82,7 @@
try {
if (testDirectory != null) {
printTrace('switching to directory $testDirectory to run tests');
- PackageMap.globalPackagesPath = path.normalize(path.absolute(PackageMap.globalPackagesPath));
+ PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(PackageMap.globalPackagesPath));
fs.currentDirectory = testDirectory;
}
printTrace('running test package with arguments: $testArgs');
@@ -139,7 +138,7 @@
Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_tools');
try {
- File sourceFile = coverageFile.copySync(path.join(tempDir.path, 'lcov.source.info'));
+ File sourceFile = coverageFile.copySync(fs.path.join(tempDir.path, 'lcov.source.info'));
ProcessResult result = processManager.runSync(<String>[
'lcov',
'--add-tracefile', baseCoverageData,
@@ -173,7 +172,7 @@
testArgs.add('--');
Directory testDir;
- Iterable<String> files = argResults.rest.map((String testPath) => path.absolute(testPath)).toList();
+ Iterable<String> files = argResults.rest.map((String testPath) => fs.path.absolute(testPath)).toList();
if (argResults['start-paused']) {
if (files.length != 1)
throwToolExit('When using --start-paused, you must specify a single test file to run.', exitCode: 1);
diff --git a/packages/flutter_tools/lib/src/commands/trace.dart b/packages/flutter_tools/lib/src/commands/trace.dart
index db011bf..75edcc2 100644
--- a/packages/flutter_tools/lib/src/commands/trace.dart
+++ b/packages/flutter_tools/lib/src/commands/trace.dart
@@ -5,8 +5,6 @@
import 'dart:async';
import 'dart:convert';
-import 'package:path/path.dart' as path;
-
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/utils.dart';
@@ -160,7 +158,7 @@
/// Download the startup trace information from the given observatory client and
/// store it to build/start_up_info.json.
Future<Null> downloadStartupTrace(VMService observatory) async {
- String traceInfoFilePath = path.join(getBuildDirectory(), 'start_up_info.json');
+ String traceInfoFilePath = fs.path.join(getBuildDirectory(), 'start_up_info.json');
File traceInfoFile = fs.file(traceInfoFilePath);
// Delete old startup data, if any.
diff --git a/packages/flutter_tools/lib/src/commands/update_packages.dart b/packages/flutter_tools/lib/src/commands/update_packages.dart
index bb8d761..2a3783b 100644
--- a/packages/flutter_tools/lib/src/commands/update_packages.dart
+++ b/packages/flutter_tools/lib/src/commands/update_packages.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/net.dart';
@@ -35,11 +33,11 @@
Future<Null> _downloadCoverageData() async {
Status status = logger.startProgress("Downloading lcov data for package:flutter...", expectSlowOperation: true);
final List<int> data = await fetchUrl(Uri.parse('https://storage.googleapis.com/flutter_infra/flutter/coverage/lcov.info'));
- final String coverageDir = path.join(Cache.flutterRoot, 'packages/flutter/coverage');
- fs.file(path.join(coverageDir, 'lcov.base.info'))
+ final String coverageDir = fs.path.join(Cache.flutterRoot, 'packages/flutter/coverage');
+ fs.file(fs.path.join(coverageDir, 'lcov.base.info'))
..createSync(recursive: true)
..writeAsBytesSync(data, flush: true);
- fs.file(path.join(coverageDir, 'lcov.info'))
+ fs.file(fs.path.join(coverageDir, 'lcov.info'))
..createSync(recursive: true)
..writeAsBytesSync(data, flush: true);
status.stop();
diff --git a/packages/flutter_tools/lib/src/commands/upgrade.dart b/packages/flutter_tools/lib/src/commands/upgrade.dart
index 6d0ee9c..73f7236 100644
--- a/packages/flutter_tools/lib/src/commands/upgrade.dart
+++ b/packages/flutter_tools/lib/src/commands/upgrade.dart
@@ -4,9 +4,8 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../base/common.dart';
+import '../base/file_system.dart';
import '../base/os.dart';
import '../base/process.dart';
import '../cache.dart';
@@ -60,7 +59,7 @@
printStatus('Upgrading engine...');
code = await runCommandAndStreamOutput(
<String>[
- path.join(Cache.flutterRoot, 'bin', 'flutter'), '--no-color', 'precache'
+ fs.path.join(Cache.flutterRoot, 'bin', 'flutter'), '--no-color', 'precache'
],
workingDirectory: Cache.flutterRoot,
allowReentrantFlutter: true
diff --git a/packages/flutter_tools/lib/src/dart/analysis.dart b/packages/flutter_tools/lib/src/dart/analysis.dart
index 92b2610..a7430a7 100644
--- a/packages/flutter_tools/lib/src/dart/analysis.dart
+++ b/packages/flutter_tools/lib/src/dart/analysis.dart
@@ -21,7 +21,6 @@
import 'package:cli_util/cli_util.dart' as cli_util;
import 'package:package_config/packages.dart' show Packages;
import 'package:package_config/src/packages_impl.dart' show MapPackages; // ignore: implementation_imports
-import 'package:path/path.dart' as path;
import 'package:plugin/manager.dart';
import 'package:plugin/plugin.dart';
@@ -47,7 +46,7 @@
DriverOptions options;
String get sdkDir {
- return options.dartSdkPath ?? path.absolute(cli_util.getSdkDir().path);
+ return options.dartSdkPath ?? fs.path.absolute(cli_util.getSdkDir().path);
}
List<AnalysisErrorDescription> analyze(Iterable<File> files) {
@@ -74,7 +73,7 @@
List<Source> sources = <Source>[];
ChangeSet changeSet = new ChangeSet();
for (File file in files) {
- JavaFile sourceFile = new JavaFile(path.normalize(file.absolute.path));
+ JavaFile sourceFile = new JavaFile(fs.path.normalize(file.absolute.path));
Source source = new FileBasedSource(sourceFile, sourceFile.toURI());
Uri uri = context.sourceFactory.restoreUri(source);
if (uri != null) {
diff --git a/packages/flutter_tools/lib/src/dart/dependencies.dart b/packages/flutter_tools/lib/src/dart/dependencies.dart
index 04240ce..5fb22c33 100644
--- a/packages/flutter_tools/lib/src/dart/dependencies.dart
+++ b/packages/flutter_tools/lib/src/dart/dependencies.dart
@@ -4,8 +4,7 @@
import 'dart:convert';
-import 'package:path/path.dart' as path;
-
+import '../base/file_system.dart';
import '../base/process.dart';
import '../toolchain.dart';
@@ -37,7 +36,7 @@
if (!line.startsWith('package:')) {
// We convert the uris so that they are relative to the project
// root.
- line = path.relative(line, from: projectRootPath);
+ line = fs.path.relative(line, from: projectRootPath);
}
minimalDependencies.add(line);
}
diff --git a/packages/flutter_tools/lib/src/dart/package_map.dart b/packages/flutter_tools/lib/src/dart/package_map.dart
index 09bab80..e2b7ab0 100644
--- a/packages/flutter_tools/lib/src/dart/package_map.dart
+++ b/packages/flutter_tools/lib/src/dart/package_map.dart
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:package_config/packages_file.dart' as packages_file;
-import 'package:path/path.dart' as path;
import '../base/file_system.dart';
@@ -46,7 +45,7 @@
List<String> pathSegments = packageUri.pathSegments.toList();
String packageName = pathSegments.removeAt(0);
Uri packageBase = map[packageName];
- String packageRelativePath = path.joinAll(pathSegments);
+ String packageRelativePath = fs.path.joinAll(pathSegments);
return packageBase.resolve(packageRelativePath).path;
}
@@ -54,7 +53,7 @@
if (fs.isFileSync(packagesPath))
return null;
String message = '$packagesPath does not exist.';
- String pubspecPath = path.absolute(path.dirname(packagesPath), 'pubspec.yaml');
+ String pubspecPath = fs.path.absolute(fs.path.dirname(packagesPath), 'pubspec.yaml');
if (fs.isFileSync(pubspecPath))
message += '\nDid you run "flutter packages get" in this directory?';
else
diff --git a/packages/flutter_tools/lib/src/dart/pub.dart b/packages/flutter_tools/lib/src/dart/pub.dart
index 889652d..4cb0a7a 100644
--- a/packages/flutter_tools/lib/src/dart/pub.dart
+++ b/packages/flutter_tools/lib/src/dart/pub.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
@@ -36,8 +34,8 @@
if (directory == null)
directory = fs.currentDirectory.path;
- File pubSpecYaml = fs.file(path.join(directory, 'pubspec.yaml'));
- File dotPackages = fs.file(path.join(directory, '.packages'));
+ File pubSpecYaml = fs.file(fs.path.join(directory, 'pubspec.yaml'));
+ File dotPackages = fs.file(fs.path.join(directory, '.packages'));
if (!pubSpecYaml.existsSync()) {
if (!skipIfAbsent)
@@ -47,7 +45,7 @@
if (!checkLastModified || _shouldRunPubGet(pubSpecYaml: pubSpecYaml, dotPackages: dotPackages)) {
String command = upgrade ? 'upgrade' : 'get';
- Status status = logger.startProgress("Running 'flutter packages $command' in ${path.basename(directory)}...",
+ Status status = logger.startProgress("Running 'flutter packages $command' in ${fs.path.basename(directory)}...",
expectSlowOperation: true);
int code = await runCommandAndStreamOutput(
<String>[sdkBinaryName('pub'), '--verbosity=warning', command, '--no-packages-dir', '--no-precompile'],
diff --git a/packages/flutter_tools/lib/src/dart/sdk.dart b/packages/flutter_tools/lib/src/dart/sdk.dart
index 150c260..64f128d 100644
--- a/packages/flutter_tools/lib/src/dart/sdk.dart
+++ b/packages/flutter_tools/lib/src/dart/sdk.dart
@@ -2,19 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
-
+import '../base/file_system.dart';
import '../base/platform.dart';
import '../cache.dart';
/// Locate the Dart SDK.
String get dartSdkPath {
- return path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk');
+ return fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk');
}
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
/// ==> `pub.bat`. The default SDK location can be overridden with a specified
/// [sdkLocation].
String sdkBinaryName(String name, { String sdkLocation }) {
- return path.absolute(path.join(sdkLocation ?? dartSdkPath, 'bin', platform.isWindows ? '$name.bat' : name));
+ return fs.path.absolute(fs.path.join(sdkLocation ?? dartSdkPath, 'bin', platform.isWindows ? '$name.bat' : name));
}
diff --git a/packages/flutter_tools/lib/src/dependency_checker.dart b/packages/flutter_tools/lib/src/dependency_checker.dart
index fc58c42..b63a0d8 100644
--- a/packages/flutter_tools/lib/src/dependency_checker.dart
+++ b/packages/flutter_tools/lib/src/dependency_checker.dart
@@ -9,8 +9,6 @@
import 'dart/package_map.dart';
import 'asset.dart';
-import 'package:path/path.dart' as pathos;
-
class DependencyChecker {
final DartDependencySetBuilder builder;
final Set<String> _dependencies = new Set<String>();
@@ -38,7 +36,7 @@
if (path.startsWith('package:')) {
path = packageMap.pathForPackage(Uri.parse(path));
} else {
- path = pathos.join(builder.projectRootPath, path);
+ path = fs.path.join(builder.projectRootPath, path);
}
_dependencies.add(path);
}
diff --git a/packages/flutter_tools/lib/src/devfs.dart b/packages/flutter_tools/lib/src/devfs.dart
index 4ddbdc1..2cd8c09 100644
--- a/packages/flutter_tools/lib/src/devfs.dart
+++ b/packages/flutter_tools/lib/src/devfs.dart
@@ -5,8 +5,6 @@
import 'dart:async';
import 'dart:convert' show BASE64, UTF8;
-import 'package:path/path.dart' as path;
-
import 'base/context.dart';
import 'base/file_system.dart';
import 'base/io.dart';
@@ -298,7 +296,7 @@
_httpWriter = new _DevFSHttpWriter(fsName, serviceProtocol),
fsName = fsName {
_packagesFilePath =
- packagesFilePath ?? path.join(rootDirectory.path, kPackagesFileName);
+ packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName);
}
DevFS.operations(this._operations,
@@ -308,7 +306,7 @@
})
: _httpWriter = null {
_packagesFilePath =
- packagesFilePath ?? path.join(rootDirectory.path, kPackagesFileName);
+ packagesFilePath ?? fs.path.join(rootDirectory.path, kPackagesFileName);
}
final DevFSOperations _operations;
@@ -365,7 +363,7 @@
// Handle deletions.
printTrace('Scanning for deleted files');
- String assetBuildDirPrefix = getAssetBuildDirectory() + path.separator;
+ String assetBuildDirPrefix = getAssetBuildDirectory() + fs.path.separator;
final List<String> toRemove = new List<String>();
_entries.forEach((String devicePath, DevFSContent content) {
if (!content._exists) {
@@ -446,7 +444,7 @@
void _scanBundleEntry(String archivePath, DevFSContent content, bool bundleDirty) {
// We write the assets into the AssetBundle working dir so that they
// are in the same location in DevFS and the iOS simulator.
- final String devicePath = path.join(getAssetBuildDirectory(), archivePath);
+ final String devicePath = fs.path.join(getAssetBuildDirectory(), archivePath);
_entries[devicePath] = content;
content._exists = true;
@@ -472,7 +470,7 @@
Set<String> fileFilter}) async {
String prefix = directoryName;
if (prefix == null) {
- prefix = path.relative(directory.path, from: rootDirectory.path);
+ prefix = fs.path.relative(directory.path, from: rootDirectory.path);
if (prefix == '.')
prefix = '';
}
@@ -494,20 +492,20 @@
continue;
}
assert((file is Link) || (file is File));
- if (ignoreDotFiles && path.basename(file.path).startsWith('.')) {
+ if (ignoreDotFiles && fs.path.basename(file.path).startsWith('.')) {
// Skip dot files.
continue;
}
final String relativePath =
- path.relative(file.path, from: directory.path);
- final String devicePath = path.join(prefix, relativePath);
+ fs.path.relative(file.path, from: directory.path);
+ final String devicePath = fs.path.join(prefix, relativePath);
bool filtered = false;
if ((fileFilter != null) &&
!fileFilter.contains(devicePath)) {
if (packagesDirectoryName != null) {
// Double check the filter for packages/packagename/
final String packagesDevicePath =
- path.join(packagesDirectoryName, relativePath);
+ fs.path.join(packagesDirectoryName, relativePath);
if (!fileFilter.contains(packagesDevicePath)) {
// File was not in the filter set.
filtered = true;
@@ -544,13 +542,13 @@
// This project's own package.
final bool isProjectPackage = uri.toString() == 'lib/';
final String directoryName =
- isProjectPackage ? 'lib' : path.join('packages', packageName);
+ isProjectPackage ? 'lib' : fs.path.join('packages', packageName);
// If this is the project's package, we need to pass both
// package:<package_name> and lib/ as paths to be checked against
// the filter because we must support both package: imports and relative
// path imports within the project's own code.
final String packagesDirectoryName =
- isProjectPackage ? path.join('packages', packageName) : null;
+ isProjectPackage ? fs.path.join('packages', packageName) : null;
Directory directory = fs.directory(uri);
bool packageExists =
await _scanDirectory(directory,
diff --git a/packages/flutter_tools/lib/src/doctor.dart b/packages/flutter_tools/lib/src/doctor.dart
index 63272ba..a7742f1 100644
--- a/packages/flutter_tools/lib/src/doctor.dart
+++ b/packages/flutter_tools/lib/src/doctor.dart
@@ -6,7 +6,6 @@
import 'dart:convert' show UTF8;
import 'package:archive/archive.dart';
-import 'package:path/path.dart' as path;
import 'android/android_workflow.dart';
import 'base/common.dart';
@@ -300,8 +299,8 @@
String _readPackageVersion(String packageName) {
String jarPath = packageName.endsWith('.jar')
- ? path.join(pluginsPath, packageName)
- : path.join(pluginsPath, packageName, 'lib', '$packageName.jar');
+ ? fs.path.join(pluginsPath, packageName)
+ : fs.path.join(pluginsPath, packageName, 'lib', '$packageName.jar');
// TODO(danrubel) look for a better way to extract a single 2K file from the zip
// rather than reading the entire file into memory.
try {
@@ -318,7 +317,7 @@
}
bool hasPackage(String packageName) {
- String packagePath = path.join(pluginsPath, packageName);
+ String packagePath = fs.path.join(pluginsPath, packageName);
if (packageName.endsWith('.jar'))
return fs.isFileSync(packagePath);
return fs.isDirectorySync(packagePath);
@@ -356,18 +355,18 @@
for (FileSystemEntity dir in fs.directory(homeDirPath).listSync()) {
if (dir is Directory) {
- String name = path.basename(dir.path);
+ String name = fs.path.basename(dir.path);
IntelliJValidator._idToTitle.forEach((String id, String title) {
if (name.startsWith('.$id')) {
String version = name.substring(id.length + 1);
String installPath;
try {
- installPath = fs.file(path.join(dir.path, 'system', '.home')).readAsStringSync();
+ installPath = fs.file(fs.path.join(dir.path, 'system', '.home')).readAsStringSync();
} catch (e) {
// ignored
}
if (installPath != null && fs.isDirectorySync(installPath)) {
- String pluginsPath = path.join(dir.path, 'config', 'plugins');
+ String pluginsPath = fs.path.join(dir.path, 'config', 'plugins');
addValidator(title, version, installPath, pluginsPath);
}
}
@@ -392,10 +391,10 @@
static Iterable<DoctorValidator> get installed {
List<DoctorValidator> validators = <DoctorValidator>[];
- List<String> installPaths = <String>['/Applications', path.join(homeDirPath, 'Applications')];
+ List<String> installPaths = <String>['/Applications', fs.path.join(homeDirPath, 'Applications')];
void checkForIntelliJ(Directory dir) {
- String name = path.basename(dir.path);
+ String name = fs.path.basename(dir.path);
_dirNameToId.forEach((String dirName, String id) {
if (name == dirName) {
String title = IntelliJValidator._idToTitle[id];
@@ -437,7 +436,7 @@
if (_version == null) {
String plist;
try {
- plist = fs.file(path.join(installPath, 'Contents', 'Info.plist')).readAsStringSync();
+ plist = fs.file(fs.path.join(installPath, 'Contents', 'Info.plist')).readAsStringSync();
int index = plist.indexOf('CFBundleShortVersionString');
if (index > 0) {
int start = plist.indexOf('<string>', index);
@@ -462,7 +461,7 @@
List<String> split = version.split('.');
String major = split[0];
String minor = split[1];
- return path.join(homeDirPath, 'Library', 'Application Support', '$id$major.$minor');
+ return fs.path.join(homeDirPath, 'Library', 'Application Support', '$id$major.$minor');
}
}
diff --git a/packages/flutter_tools/lib/src/flx.dart b/packages/flutter_tools/lib/src/flx.dart
index 9c4f22f..4d7e541 100644
--- a/packages/flutter_tools/lib/src/flx.dart
+++ b/packages/flutter_tools/lib/src/flx.dart
@@ -4,8 +4,6 @@
import 'dart:async';
-import 'package:path/path.dart' as path;
-
import 'asset.dart';
import 'base/common.dart';
import 'base/file_system.dart';
@@ -20,9 +18,9 @@
const String defaultMainPath = 'lib/main.dart';
const String defaultAssetBasePath = '.';
const String defaultManifestPath = 'pubspec.yaml';
-String get defaultFlxOutputPath => path.join(getBuildDirectory(), 'app.flx');
-String get defaultSnapshotPath => path.join(getBuildDirectory(), 'snapshot_blob.bin');
-String get defaultDepfilePath => path.join(getBuildDirectory(), 'snapshot_blob.bin.d');
+String get defaultFlxOutputPath => fs.path.join(getBuildDirectory(), 'app.flx');
+String get defaultSnapshotPath => fs.path.join(getBuildDirectory(), 'snapshot_blob.bin');
+String get defaultDepfilePath => fs.path.join(getBuildDirectory(), 'snapshot_blob.bin.d');
const String defaultPrivateKeyPath = 'privatekey.der';
const String _kSnapshotKey = 'snapshot_blob.bin';
@@ -89,7 +87,7 @@
snapshotPath ??= defaultSnapshotPath;
depfilePath ??= defaultDepfilePath;
workingDirPath ??= getAssetBuildDirectory();
- packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
+ packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath);
File snapshotFile;
if (!precompiledSnapshot) {
@@ -135,7 +133,7 @@
}) async {
outputPath ??= defaultFlxOutputPath;
workingDirPath ??= getAssetBuildDirectory();
- packagesPath ??= path.absolute(PackageMap.globalPackagesPath);
+ packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath);
printTrace('Building $outputPath');
// Build the asset bundle.
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 3f04029..fa229e0 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -6,7 +6,6 @@
import 'dart:convert' show JSON;
import 'package:meta/meta.dart';
-import 'package:path/path.dart' as path;
import '../application_package.dart';
import '../base/context.dart';
@@ -133,11 +132,11 @@
List<FileSystemEntity> contents = fs.directory(app.appDirectory).listSync();
for (FileSystemEntity entity in contents) {
- if (path.extension(entity.path) == '.xcworkspace') {
+ if (fs.path.extension(entity.path) == '.xcworkspace') {
commands.addAll(<String>[
- '-workspace', path.basename(entity.path),
- '-scheme', path.basenameWithoutExtension(entity.path),
- "BUILD_DIR=${path.absolute(getIosBuildDirectory())}",
+ '-workspace', fs.path.basename(entity.path),
+ '-scheme', fs.path.basenameWithoutExtension(entity.path),
+ "BUILD_DIR=${fs.path.absolute(getIosBuildDirectory())}",
]);
break;
}
@@ -191,7 +190,7 @@
Match match = regexp.firstMatch(result.stdout);
String outputDir;
if (match != null)
- outputDir = path.join(app.appDirectory, match.group(1));
+ outputDir = fs.path.join(app.appDirectory, match.group(1));
return new XcodeBuildResult(success:true, output: outputDir);
}
}
@@ -320,17 +319,17 @@
printTrace("Found ${services.length} service definition(s).");
// Step 2: Copy framework dylibs to the correct spot for xcodebuild to pick up.
- Directory frameworksDirectory = fs.directory(path.join(bundle.path, "Frameworks"));
+ Directory frameworksDirectory = fs.directory(fs.path.join(bundle.path, "Frameworks"));
await _copyServiceFrameworks(services, frameworksDirectory);
// Step 3: Copy the service definitions manifest at the correct spot for
// xcodebuild to pick up.
- File manifestFile = fs.file(path.join(bundle.path, "ServiceDefinitions.json"));
+ File manifestFile = fs.file(fs.path.join(bundle.path, "ServiceDefinitions.json"));
_copyServiceDefinitionsManifest(services, manifestFile);
}
Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Directory frameworksDirectory) async {
- printTrace("Copying service frameworks to '${path.absolute(frameworksDirectory.path)}'.");
+ printTrace("Copying service frameworks to '${fs.path.absolute(frameworksDirectory.path)}'.");
frameworksDirectory.createSync(recursive: true);
for (Map<String, String> service in services) {
String dylibPath = await getServiceFromUrl(service['ios-framework'], service['root'], service['name']);
@@ -351,7 +350,7 @@
'name': service['name'],
// Since we have already moved it to the Frameworks directory. Strip away
// the directory and basenames.
- 'framework': path.basenameWithoutExtension(service['ios-framework'])
+ 'framework': fs.path.basenameWithoutExtension(service['ios-framework'])
}).toList();
Map<String, dynamic> json = <String, dynamic>{ 'services' : jsonServices };
manifest.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
diff --git a/packages/flutter_tools/lib/src/ios/plist_utils.dart b/packages/flutter_tools/lib/src/ios/plist_utils.dart
index bee1b23..2392468 100644
--- a/packages/flutter_tools/lib/src/ios/plist_utils.dart
+++ b/packages/flutter_tools/lib/src/ios/plist_utils.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
-
import '../base/file_system.dart';
import '../base/process.dart';
@@ -20,7 +18,7 @@
if (!fs.isFileSync(plistFilePath))
return null;
- String normalizedPlistPath = path.withoutExtension(path.absolute(plistFilePath));
+ String normalizedPlistPath = fs.path.withoutExtension(fs.path.absolute(plistFilePath));
try {
String value = runCheckedSync(<String>[
diff --git a/packages/flutter_tools/lib/src/ios/simulators.dart b/packages/flutter_tools/lib/src/ios/simulators.dart
index fcad6a7..432f373 100644
--- a/packages/flutter_tools/lib/src/ios/simulators.dart
+++ b/packages/flutter_tools/lib/src/ios/simulators.dart
@@ -6,8 +6,6 @@
import 'dart:convert';
import 'dart:math' as math;
-import 'package:path/path.dart' as path;
-
import '../application_package.dart';
import '../base/common.dart';
import '../base/context.dart';
@@ -319,17 +317,17 @@
Map<ApplicationPackage, _IOSSimulatorLogReader> _logReaders;
_IOSSimulatorDevicePortForwarder _portForwarder;
- String get xcrunPath => path.join('/usr', 'bin', 'xcrun');
+ String get xcrunPath => fs.path.join('/usr', 'bin', 'xcrun');
String _getSimulatorPath() {
- return path.join(homeDirPath, 'Library', 'Developer', 'CoreSimulator', 'Devices', id);
+ return fs.path.join(homeDirPath, 'Library', 'Developer', 'CoreSimulator', 'Devices', id);
}
String _getSimulatorAppHomeDirectory(ApplicationPackage app) {
String simulatorPath = _getSimulatorPath();
if (simulatorPath == null)
return null;
- return path.join(simulatorPath, 'data');
+ return fs.path.join(simulatorPath, 'data');
}
@override
@@ -438,9 +436,9 @@
if (!prebuiltApplication) {
args.addAll(<String>[
- '--flx=${path.absolute(path.join(getBuildDirectory(), 'app.flx'))}',
- '--dart-main=${path.absolute(mainPath)}',
- '--packages=${path.absolute('.packages')}',
+ '--flx=${fs.path.absolute(fs.path.join(getBuildDirectory(), 'app.flx'))}',
+ '--dart-main=${fs.path.absolute(mainPath)}',
+ '--packages=${fs.path.absolute('.packages')}',
]);
}
@@ -520,7 +518,7 @@
throwToolExit('Could not find the built application bundle at ${bundle.path}.');
// Step 3: Install the updated bundle to the simulator.
- SimControl.instance.install(id, path.absolute(bundle.path));
+ SimControl.instance.install(id, fs.path.absolute(bundle.path));
}
Future<Null> _sideloadUpdatedAssetsForInstalledApplicationBundle(ApplicationPackage app) =>
@@ -536,14 +534,14 @@
ApplicationPackage app, String localFile, String targetFile) async {
if (p.platform.isMacOS) {
String simulatorHomeDirectory = _getSimulatorAppHomeDirectory(app);
- runCheckedSync(<String>['cp', localFile, path.join(simulatorHomeDirectory, targetFile)]);
+ runCheckedSync(<String>['cp', localFile, fs.path.join(simulatorHomeDirectory, targetFile)]);
return true;
}
return false;
}
String get logFilePath {
- return path.join(homeDirPath, 'Library', 'Logs', 'CoreSimulator', id, 'system.log');
+ return fs.path.join(homeDirPath, 'Library', 'Logs', 'CoreSimulator', id, 'system.log');
}
@override
@@ -587,13 +585,13 @@
@override
Future<Null> takeScreenshot(File outputFile) async {
- Directory desktopDir = fs.directory(path.join(homeDirPath, 'Desktop'));
+ Directory desktopDir = fs.directory(fs.path.join(homeDirPath, 'Desktop'));
// 'Simulator Screen Shot Mar 25, 2016, 2.59.43 PM.png'
Set<File> getScreenshots() {
return new Set<File>.from(desktopDir.listSync().where((FileSystemEntity entity) {
- String name = path.basename(entity.path);
+ String name = fs.path.basename(entity.path);
return entity is File && name.startsWith('Simulator') && name.endsWith('.png');
}));
}
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
index 3d440e1..16a0aec 100644
--- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart
+++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
-
import '../base/file_system.dart';
import '../base/process.dart';
import '../build_info.dart';
@@ -18,11 +16,11 @@
localsBuffer.writeln('// This is a generated file; do not edit or check into version control.');
- String flutterRoot = path.normalize(Cache.flutterRoot);
+ String flutterRoot = fs.path.normalize(Cache.flutterRoot);
localsBuffer.writeln('FLUTTER_ROOT=$flutterRoot');
// This holds because requiresProjectRoot is true for this command
- String applicationRoot = path.normalize(fs.currentDirectory.path);
+ String applicationRoot = fs.path.normalize(fs.currentDirectory.path);
localsBuffer.writeln('FLUTTER_APPLICATION_PATH=$applicationRoot');
// Relative to FLUTTER_APPLICATION_PATH, which is [Directory.current].
@@ -36,19 +34,19 @@
localsBuffer.writeln('SYMROOT=\${SOURCE_ROOT}/../${getIosBuildDirectory()}');
- String flutterFrameworkDir = path.normalize(tools.getEngineArtifactsDirectory(TargetPlatform.ios, mode).path);
+ String flutterFrameworkDir = fs.path.normalize(tools.getEngineArtifactsDirectory(TargetPlatform.ios, mode).path);
localsBuffer.writeln('FLUTTER_FRAMEWORK_DIR=$flutterFrameworkDir');
if (tools.isLocalEngine)
localsBuffer.writeln('LOCAL_ENGINE=${tools.engineBuildPath}');
- File localsFile = fs.file(path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig'));
+ File localsFile = fs.file(fs.path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig'));
localsFile.createSync(recursive: true);
localsFile.writeAsStringSync(localsBuffer.toString());
}
Map<String, String> getXcodeBuildSettings(String xcodeProjPath, String target) {
- String absProjPath = path.absolute(xcodeProjPath);
+ String absProjPath = fs.path.absolute(xcodeProjPath);
String out = runCheckedSync(<String>[
'/usr/bin/xcodebuild', '-project', absProjPath, '-target', target, '-showBuildSettings'
]);
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 32464f1..235ccdc 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'package:meta/meta.dart';
-import 'package:path/path.dart' as path;
import 'application_package.dart';
import 'asset.dart';
@@ -37,7 +36,7 @@
_mainPath = findMainDartFile(target);
_projectRootPath = projectRootPath ?? fs.currentDirectory.path;
_packagesFilePath =
- packagesFilePath ?? path.absolute(PackageMap.globalPackagesPath);
+ packagesFilePath ?? fs.path.absolute(PackageMap.globalPackagesPath);
if (projectAssets != null)
_assetBundle = new AssetBundle.fixed(_projectRootPath, projectAssets);
else
@@ -133,7 +132,7 @@
}
int sizeKB = (await outputFile.length()) ~/ 1024;
status.stop();
- printStatus('Screenshot written to ${path.relative(outputFile.path)} (${sizeKB}kB).');
+ printStatus('Screenshot written to ${fs.path.relative(outputFile.path)} (${sizeKB}kB).');
} catch (error) {
status.stop();
printError('Error taking screenshot: $error');
@@ -377,9 +376,9 @@
String findMainDartFile([String target]) {
if (target == null)
target = '';
- String targetPath = path.absolute(target);
+ String targetPath = fs.path.absolute(target);
if (fs.isDirectorySync(targetPath))
- return path.join(targetPath, 'lib', 'main.dart');
+ return fs.path.join(targetPath, 'lib', 'main.dart');
else
return targetPath;
}
diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart
index b83cd81..e472429 100644
--- a/packages/flutter_tools/lib/src/run_hot.dart
+++ b/packages/flutter_tools/lib/src/run_hot.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'package:meta/meta.dart';
-import 'package:path/path.dart' as path;
import 'package:stack_trace/stack_trace.dart';
import 'application_package.dart';
@@ -257,7 +256,7 @@
DevFS _devFS;
Future<Uri> _initDevFS() {
- String fsName = path.basename(projectRootPath);
+ String fsName = fs.path.basename(projectRootPath);
_devFS = new DevFS(vmService,
fsName,
fs.directory(projectRootPath),
@@ -324,7 +323,7 @@
Future<Null> _launchFromDevFS(ApplicationPackage package,
String mainScript) async {
- String entryPath = path.relative(mainScript, from: projectRootPath);
+ String entryPath = fs.path.relative(mainScript, from: projectRootPath);
String deviceEntryPath =
_devFS.baseUri.resolve(entryPath).toFilePath();
String devicePackagesPath =
@@ -435,7 +434,7 @@
return new OperationResult(1, 'Dart Source Error');
String reloadMessage;
try {
- String entryPath = path.relative(mainPath, from: projectRootPath);
+ String entryPath = fs.path.relative(mainPath, from: projectRootPath);
String deviceEntryPath =
_devFS.baseUri.resolve(entryPath).toFilePath();
String devicePackagesPath =
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
index 78f2efb..1eeea2c 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
@@ -6,7 +6,6 @@
import 'package:args/args.dart';
import 'package:args/command_runner.dart';
-import 'package:path/path.dart' as path;
import '../android/android_sdk.dart';
import '../base/common.dart';
@@ -124,10 +123,10 @@
if (platform.script.scheme == 'data')
return '../..'; // we're running as a test
String script = platform.script.toFilePath();
- if (path.basename(script) == kSnapshotFileName)
- return path.dirname(path.dirname(path.dirname(script)));
- if (path.basename(script) == kFlutterToolsScriptFileName)
- return path.dirname(path.dirname(path.dirname(path.dirname(script))));
+ if (fs.path.basename(script) == kSnapshotFileName)
+ return fs.path.dirname(fs.path.dirname(fs.path.dirname(script)));
+ if (fs.path.basename(script) == kFlutterToolsScriptFileName)
+ return fs.path.dirname(fs.path.dirname(fs.path.dirname(fs.path.dirname(script))));
// If run from a bare script within the repo.
if (script.contains('flutter/packages/'))
@@ -188,7 +187,7 @@
// We must set Cache.flutterRoot early because other features use it (e.g.
// enginePath's initialiser uses it).
- Cache.flutterRoot = path.normalize(path.absolute(globalResults['flutter-root']));
+ Cache.flutterRoot = fs.path.normalize(fs.path.absolute(globalResults['flutter-root']));
if (platform.environment['FLUTTER_ALREADY_LOCKED'] != 'true')
await Cache.lock();
@@ -199,7 +198,7 @@
_checkFlutterCopy();
if (globalResults.wasParsed('packages'))
- PackageMap.globalPackagesPath = path.normalize(path.absolute(globalResults['packages']));
+ PackageMap.globalPackagesPath = fs.path.normalize(fs.path.absolute(globalResults['packages']));
// See if the user specified a specific device.
deviceManager.specifiedDeviceId = globalResults['device-id'];
@@ -224,7 +223,7 @@
}
String _tryEnginePath(String enginePath) {
- if (fs.isDirectorySync(path.join(enginePath, 'out')))
+ if (fs.isDirectorySync(fs.path.join(enginePath, 'out')))
return enginePath;
return null;
}
@@ -236,15 +235,15 @@
try {
Uri engineUri = new PackageMap(PackageMap.globalPackagesPath).map[kFlutterEnginePackageName];
if (engineUri != null) {
- engineSourcePath = path.dirname(path.dirname(path.dirname(path.dirname(engineUri.path))));
- bool dirExists = fs.isDirectorySync(path.join(engineSourcePath, 'out'));
+ engineSourcePath = fs.path.dirname(fs.path.dirname(fs.path.dirname(fs.path.dirname(engineUri.path))));
+ bool dirExists = fs.isDirectorySync(fs.path.join(engineSourcePath, 'out'));
if (engineSourcePath == '/' || engineSourcePath.isEmpty || !dirExists)
engineSourcePath = null;
}
} on FileSystemException { } on FormatException { }
if (engineSourcePath == null)
- engineSourcePath = _tryEnginePath(path.join(Cache.flutterRoot, '../engine/src'));
+ engineSourcePath = _tryEnginePath(fs.path.join(Cache.flutterRoot, '../engine/src'));
if (engineSourcePath == null) {
printError('Unable to detect local Flutter engine build directory.\n'
@@ -274,7 +273,7 @@
throw new ProcessExit(2);
}
- String engineBuildPath = path.normalize(path.join(enginePath, 'out', localEngine));
+ String engineBuildPath = fs.path.normalize(fs.path.join(enginePath, 'out', localEngine));
if (!fs.isDirectorySync(engineBuildPath)) {
printError('No Flutter engine build found at $engineBuildPath.');
throw new ProcessExit(2);
@@ -290,16 +289,16 @@
/// Get all pub packages in the Flutter repo.
List<Directory> getRepoPackages() {
- return _gatherProjectPaths(path.absolute(Cache.flutterRoot))
+ return _gatherProjectPaths(fs.path.absolute(Cache.flutterRoot))
.map((String dir) => fs.directory(dir))
.toList();
}
static List<String> _gatherProjectPaths(String rootPath) {
- if (fs.isFileSync(path.join(rootPath, '.dartignore')))
+ if (fs.isFileSync(fs.path.join(rootPath, '.dartignore')))
return <String>[];
- if (fs.isFileSync(path.join(rootPath, 'pubspec.yaml')))
+ if (fs.isFileSync(fs.path.join(rootPath, 'pubspec.yaml')))
return <String>[rootPath];
return fs.directory(rootPath)
@@ -312,15 +311,15 @@
/// Get the entry-points we want to analyze in the Flutter repo.
List<Directory> getRepoAnalysisEntryPoints() {
- final String rootPath = path.absolute(Cache.flutterRoot);
+ final String rootPath = fs.path.absolute(Cache.flutterRoot);
final List<Directory> result = <Directory>[
// not bin, and not the root
- fs.directory(path.join(rootPath, 'dev')),
- fs.directory(path.join(rootPath, 'examples')),
+ fs.directory(fs.path.join(rootPath, 'dev')),
+ fs.directory(fs.path.join(rootPath, 'examples')),
];
// And since analyzer refuses to look at paths that end in "packages/":
result.addAll(
- _gatherProjectPaths(path.join(rootPath, 'packages'))
+ _gatherProjectPaths(fs.path.join(rootPath, 'packages'))
.map<Directory>((String path) => fs.directory(path))
);
return result;
@@ -329,7 +328,7 @@
void _checkFlutterCopy() {
// If the current directory is contained by a flutter repo, check that it's
// the same flutter that is currently running.
- String directory = path.normalize(path.absolute(fs.currentDirectory.path));
+ String directory = fs.path.normalize(fs.path.absolute(fs.currentDirectory.path));
// Check if the cwd is a flutter dir.
while (directory.isNotEmpty) {
@@ -347,7 +346,7 @@
break;
}
- String parent = path.dirname(directory);
+ String parent = fs.path.dirname(directory);
if (parent == directory)
break;
directory = parent;
@@ -361,7 +360,7 @@
if (flutterUri != null && (flutterUri.scheme == 'file' || flutterUri.scheme == '')) {
// .../flutter/packages/flutter/lib
Uri rootUri = flutterUri.resolve('../../..');
- String flutterPath = path.normalize(fs.file(rootUri).absolute.path);
+ String flutterPath = fs.path.normalize(fs.file(rootUri).absolute.path);
if (!fs.isDirectorySync(flutterPath)) {
printError(
@@ -394,14 +393,14 @@
// Check if `bin/flutter` and `bin/cache/engine.stamp` exist.
bool _isDirectoryFlutterRepo(String directory) {
return
- fs.isFileSync(path.join(directory, 'bin/flutter')) &&
- fs.isFileSync(path.join(directory, 'bin/cache/engine.stamp'));
+ fs.isFileSync(fs.path.join(directory, 'bin/flutter')) &&
+ fs.isFileSync(fs.path.join(directory, 'bin/cache/engine.stamp'));
}
}
bool _compareResolvedPaths(String path1, String path2) {
- path1 = fs.directory(path.absolute(path1)).resolveSymbolicLinksSync();
- path2 = fs.directory(path.absolute(path2)).resolveSymbolicLinksSync();
+ path1 = fs.directory(fs.path.absolute(path1)).resolveSymbolicLinksSync();
+ path2 = fs.directory(fs.path.absolute(path2)).resolveSymbolicLinksSync();
return path1 == path2;
}
diff --git a/packages/flutter_tools/lib/src/services.dart b/packages/flutter_tools/lib/src/services.dart
index af3e6cc..8df1392 100644
--- a/packages/flutter_tools/lib/src/services.dart
+++ b/packages/flutter_tools/lib/src/services.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'dart:convert';
-import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';
import 'base/file_system.dart';
@@ -86,7 +85,7 @@
return await cache.getThirdPartyFile(url, serviceName, unzip: unzip);
} else {
// Assume url is a path relative to the service's root dir.
- return path.join(rootDir, url);
+ return fs.path.join(rootDir, url);
}
}
@@ -107,7 +106,7 @@
}).toList();
Map<String, dynamic> json = <String, dynamic>{ 'services': services };
- File servicesFile = fs.file(path.join(dir, 'services.json'));
+ File servicesFile = fs.file(fs.path.join(dir, 'services.json'));
servicesFile.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
return servicesFile;
}
diff --git a/packages/flutter_tools/lib/src/template.dart b/packages/flutter_tools/lib/src/template.dart
index fc164a2..958a688 100644
--- a/packages/flutter_tools/lib/src/template.dart
+++ b/packages/flutter_tools/lib/src/template.dart
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:mustache/mustache.dart' as mustache;
-import 'package:path/path.dart' as path;
import 'base/file_system.dart';
import 'cache.dart';
@@ -39,14 +38,14 @@
continue;
}
- String relativePath = path.relative(entity.path,
+ String relativePath = fs.path.relative(entity.path,
from: baseDir.absolute.path);
if (relativePath.contains(_kTemplateExtension)) {
// If '.tmpl' appears anywhere within the path of this entity, it is
// is a candidate for rendering. This catches cases where the folder
// itself is a template.
- _templateFilePaths[relativePath] = path.absolute(entity.path);
+ _templateFilePaths[relativePath] = fs.path.absolute(entity.path);
}
}
}
@@ -71,14 +70,14 @@
String destinationDirPath = destination.absolute.path;
_templateFilePaths.forEach((String relativeDestPath, String absoluteSrcPath) {
- String finalDestinationPath = path
+ String finalDestinationPath = fs.path
.join(destinationDirPath, relativeDestPath)
.replaceAll(_kCopyTemplateExtension, '')
.replaceAll(_kTemplateExtension, '');
if (projectName != null)
finalDestinationPath = finalDestinationPath.replaceAll('projectName', projectName);
File finalDestinationFile = fs.file(finalDestinationPath);
- String relativePathForLogging = path.relative(finalDestinationFile.path);
+ String relativePathForLogging = fs.path.relative(finalDestinationFile.path);
// Step 1: Check if the file needs to be overwritten.
@@ -132,7 +131,7 @@
}
Directory _templateDirectoryInPackage(String name) {
- String templatesDir = path.join(Cache.flutterRoot,
+ String templatesDir = fs.path.join(Cache.flutterRoot,
'packages', 'flutter_tools', 'templates');
- return fs.directory(path.join(templatesDir, name));
+ return fs.directory(fs.path.join(templatesDir, name));
}
diff --git a/packages/flutter_tools/lib/src/test/coverage_collector.dart b/packages/flutter_tools/lib/src/test/coverage_collector.dart
index 8e50368..1c63885 100644
--- a/packages/flutter_tools/lib/src/test/coverage_collector.dart
+++ b/packages/flutter_tools/lib/src/test/coverage_collector.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'package:coverage/coverage.dart';
-import 'package:path/path.dart' as path;
import '../base/file_system.dart';
import '../base/io.dart';
@@ -66,7 +65,7 @@
if (formatter == null) {
Resolver resolver = new Resolver(packagesPath: PackageMap.globalPackagesPath);
String packagePath = fs.currentDirectory.path;
- List<String> reportOn = <String>[path.join(packagePath, 'lib')];
+ List<String> reportOn = <String>[fs.path.join(packagePath, 'lib')];
formatter = new LcovFormatter(resolver, reportOn: reportOn, basePath: packagePath);
}
String result = await formatter.format(_globalHitmap);
diff --git a/packages/flutter_tools/lib/src/test/flutter_platform.dart b/packages/flutter_tools/lib/src/test/flutter_platform.dart
index ac2a3b1..c812ee4 100644
--- a/packages/flutter_tools/lib/src/test/flutter_platform.dart
+++ b/packages/flutter_tools/lib/src/test/flutter_platform.dart
@@ -6,7 +6,6 @@
import 'dart:convert';
import 'package:meta/meta.dart';
-import 'package:path/path.dart' as path;
import 'package:stream_channel/stream_channel.dart';
import 'package:test/src/backend/test_platform.dart'; // ignore: implementation_imports
@@ -164,7 +163,7 @@
File listenerFile = fs.file('${temporaryDirectory.path}/listener.dart');
listenerFile.createSync();
listenerFile.writeAsStringSync(_generateTestMain(
- testUrl: path.toUri(path.absolute(testPath)).toString(),
+ testUrl: fs.path.toUri(fs.path.absolute(testPath)).toString(),
encodedWebsocketUrl: Uri.encodeComponent("ws://${_kHost.address}:${server.port}"),
));
diff --git a/packages/flutter_tools/lib/src/toolchain.dart b/packages/flutter_tools/lib/src/toolchain.dart
index 53cb1d0..f60c6e2 100644
--- a/packages/flutter_tools/lib/src/toolchain.dart
+++ b/packages/flutter_tools/lib/src/toolchain.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:path/path.dart' as path;
-
import 'base/context.dart';
import 'base/file_system.dart';
import 'build_info.dart';
@@ -56,27 +54,27 @@
// Create something like `android-arm` or `android-arm-release`.
String dirName = getNameForTargetPlatform(platform) + suffix;
Directory engineDir = cache.getArtifactDirectory('engine');
- return fs.directory(path.join(engineDir.path, dirName));
+ return fs.directory(fs.path.join(engineDir.path, dirName));
}
}
String getHostToolPath(HostTool tool) {
if (engineBuildPath == null) {
- return path.join(cache.getArtifactDirectory('engine').path,
+ return fs.path.join(cache.getArtifactDirectory('engine').path,
getNameForHostPlatform(getCurrentHostPlatform()),
_kHostToolFileName[tool]);
}
if (tool == HostTool.SkySnapshot) {
- String clangPath = path.join(engineBuildPath, 'clang_x64', 'sky_snapshot');
+ String clangPath = fs.path.join(engineBuildPath, 'clang_x64', 'sky_snapshot');
if (fs.isFileSync(clangPath))
return clangPath;
- return path.join(engineBuildPath, 'sky_snapshot');
+ return fs.path.join(engineBuildPath, 'sky_snapshot');
} else if (tool == HostTool.SkyShell) {
if (getCurrentHostPlatform() == HostPlatform.linux_x64) {
- return path.join(engineBuildPath, 'sky_shell');
+ return fs.path.join(engineBuildPath, 'sky_shell');
} else if (getCurrentHostPlatform() == HostPlatform.darwin_x64) {
- return path.join(engineBuildPath, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell');
+ return fs.path.join(engineBuildPath, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell');
}
}
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index f1928b5..63632cf 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -7,10 +7,10 @@
import 'package:json_rpc_2/error_code.dart' as rpc_error_code;
import 'package:json_rpc_2/json_rpc_2.dart' as rpc;
-import 'package:path/path.dart' as path;
import 'package:stream_channel/stream_channel.dart';
import 'package:web_socket_channel/io.dart';
+import 'base/file_system.dart';
import 'base/io.dart';
import 'globals.dart';
@@ -35,7 +35,7 @@
/// Requests made via the returns [VMService] time out after [requestTimeout]
/// amount of time, which is [kDefaultRequestTimeout] by default.
static Future<VMService> connect(Uri httpUri, { Duration requestTimeout: kDefaultRequestTimeout }) async {
- Uri wsUri = httpUri.replace(scheme: 'ws', path: path.join(httpUri.path, 'ws'));
+ Uri wsUri = httpUri.replace(scheme: 'ws', path: fs.path.join(httpUri.path, 'ws'));
WebSocket ws;
try {
ws = await WebSocket.connect(wsUri.toString());
diff --git a/packages/flutter_tools/lib/src/zip.dart b/packages/flutter_tools/lib/src/zip.dart
index 788709e..2b7a300 100644
--- a/packages/flutter_tools/lib/src/zip.dart
+++ b/packages/flutter_tools/lib/src/zip.dart
@@ -5,7 +5,6 @@
import 'dart:async';
import 'package:archive/archive.dart';
-import 'package:path/path.dart' as path;
import 'devfs.dart';
import 'base/file_system.dart';
@@ -74,7 +73,7 @@
int count = entries.length;
entries.forEach((String archivePath, DevFSContent content) {
content.contentsAsBytes().then<Null>((List<int> data) {
- File file = fs.file(path.join(zipBuildDir.path, archivePath));
+ File file = fs.file(fs.path.join(zipBuildDir.path, archivePath));
file.parent.createSync(recursive: true);
file.writeAsBytes(data).then<Null>((File value) {
count -= 1;