mirror of
https://github.com/flutter/packages.git
synced 2025-08-06 17:28:42 +08:00
[flutter_plugin_tools] Simplify filesystem usage (#4014)
- Replaces most explicit use of `fileSystem` with path construction using the `child*` utility methods - Removes explicit passing of a filesystem to the commands; we're already passing a `Directory` for the root where the tool operates, and we should never be using a different filesystem than that directory's filesystem, so passing it was both redundant, and a potential source of test bugs.
This commit is contained in:
@ -20,10 +20,9 @@ final Uri _googleFormatterUrl = Uri.https('github.com',
|
||||
class FormatCommand extends PluginCommand {
|
||||
/// Creates an instance of the format command.
|
||||
FormatCommand(
|
||||
Directory packagesDir,
|
||||
FileSystem fileSystem, {
|
||||
Directory packagesDir, {
|
||||
ProcessRunner processRunner = const ProcessRunner(),
|
||||
}) : super(packagesDir, fileSystem, processRunner: processRunner) {
|
||||
}) : super(packagesDir, processRunner: processRunner) {
|
||||
argParser.addFlag('fail-on-change', hide: true);
|
||||
argParser.addOption('clang-format',
|
||||
defaultsTo: 'clang-format',
|
||||
@ -144,7 +143,8 @@ class FormatCommand extends PluginCommand {
|
||||
final String javaFormatterPath = p.join(
|
||||
p.dirname(p.fromUri(io.Platform.script)),
|
||||
'google-java-format-1.3-all-deps.jar');
|
||||
final File javaFormatterFile = fileSystem.file(javaFormatterPath);
|
||||
final File javaFormatterFile =
|
||||
packagesDir.fileSystem.file(javaFormatterPath);
|
||||
|
||||
if (!javaFormatterFile.existsSync()) {
|
||||
print('Downloading Google Java Format...');
|
||||
|
Reference in New Issue
Block a user