mirror of
https://github.com/flutter/packages.git
synced 2025-06-08 04:18:49 +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:
@ -73,15 +73,13 @@ Map<Version, NextVersionType> getAllowedNextVersions(
|
||||
class VersionCheckCommand extends PluginCommand {
|
||||
/// Creates an instance of the version check command.
|
||||
VersionCheckCommand(
|
||||
Directory packagesDir,
|
||||
FileSystem fileSystem, {
|
||||
Directory packagesDir, {
|
||||
ProcessRunner processRunner = const ProcessRunner(),
|
||||
GitDir gitDir,
|
||||
this.httpClient,
|
||||
}) : _pubVersionFinder =
|
||||
PubVersionFinder(httpClient: httpClient ?? http.Client()),
|
||||
super(packagesDir, fileSystem,
|
||||
processRunner: processRunner, gitDir: gitDir) {
|
||||
super(packagesDir, processRunner: processRunner, gitDir: gitDir) {
|
||||
argParser.addFlag(
|
||||
_againstPubFlag,
|
||||
help: 'Whether the version check should run against the version on pub.\n'
|
||||
@ -117,7 +115,7 @@ class VersionCheckCommand extends PluginCommand {
|
||||
const String indentation = ' ';
|
||||
for (final String pubspecPath in changedPubspecs) {
|
||||
print('Checking versions for $pubspecPath...');
|
||||
final File pubspecFile = fileSystem.file(pubspecPath);
|
||||
final File pubspecFile = packagesDir.fileSystem.file(pubspecPath);
|
||||
if (!pubspecFile.existsSync()) {
|
||||
print('${indentation}Deleted; skipping.');
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user