Update flutter_tools to use package:file throughout (#7385) This removes direct file access from within flutter_tools in favor of using `package:file` via a `FileSystem` that's accessed via the `ApplicationContext`. This lays the groundwork for us to be able to easily swap out the underlying file system when running Flutter tools, which will be used to provide a record/replay file system, analogous to what we have for process invocations.
diff --git a/packages/flutter_tools/lib/src/ios/xcodeproj.dart b/packages/flutter_tools/lib/src/ios/xcodeproj.dart index 6d1bc49..3d440e1 100644 --- a/packages/flutter_tools/lib/src/ios/xcodeproj.dart +++ b/packages/flutter_tools/lib/src/ios/xcodeproj.dart
@@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import 'dart:io'; - import 'package:path/path.dart' as path; +import '../base/file_system.dart'; import '../base/process.dart'; import '../build_info.dart'; import '../cache.dart'; @@ -23,7 +22,7 @@ localsBuffer.writeln('FLUTTER_ROOT=$flutterRoot'); // This holds because requiresProjectRoot is true for this command - String applicationRoot = path.normalize(Directory.current.path); + String applicationRoot = path.normalize(fs.currentDirectory.path); localsBuffer.writeln('FLUTTER_APPLICATION_PATH=$applicationRoot'); // Relative to FLUTTER_APPLICATION_PATH, which is [Directory.current]. @@ -43,7 +42,7 @@ if (tools.isLocalEngine) localsBuffer.writeln('LOCAL_ENGINE=${tools.engineBuildPath}'); - File localsFile = new File(path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig')); + File localsFile = fs.file(path.join(projectPath, 'ios', 'Flutter', 'Generated.xcconfig')); localsFile.createSync(recursive: true); localsFile.writeAsStringSync(localsBuffer.toString()); }