From b48db59d7e9d478d5c17569a104bf886b91c3add Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Wed, 12 Jun 2024 18:42:31 -0500 Subject: [PATCH] [devtools_tool] Platform agnostic package root determination (#7924) --- tool/lib/model.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tool/lib/model.dart b/tool/lib/model.dart index 87e89e8b80f..2f9d6a0f059 100644 --- a/tool/lib/model.dart +++ b/tool/lib/model.dart @@ -78,12 +78,12 @@ class DevToolsRepo { void _collectPackages(Directory dir, List result) { // Do not collect packages from the Flutter SDK that is stored in the tool/ // directory. - if (dir.path.contains('flutter-sdk/')) return; + if (dir.path.contains(path.join('tool', 'flutter-sdk'))) return; // Do not include the top level devtools/packages directory in the results // even though it has a pubspec.yaml file. if (_fileExists(dir, 'pubspec.yaml') && - !dir.path.endsWith('/devtools/packages')) { + !dir.path.endsWith(path.join('devtools', 'packages'))) { result.add(Package._(this, dir.path)); } @@ -240,7 +240,7 @@ class Package { final name = path.basename(entity.path); if (entity is Directory && !name.startsWith('.') && name != 'build') { _collectDartFiles(entity, result); - } else if (entity is File && name.endsWith('.dart')) { + } else if (entity is File && path.extension(name) == '.dart') { result.add(entity.path); } }