Don't print 'Resolving dependencies in `../..`...' Use absolute path instead (#4231)
diff --git a/lib/src/entrypoint.dart b/lib/src/entrypoint.dart
index 562d6af..704264d 100644
--- a/lib/src/entrypoint.dart
+++ b/lib/src/entrypoint.dart
@@ -516,7 +516,9 @@
}) async {
workspaceRoot; // This will throw early if pubspec.yaml could not be found.
summaryOnly = summaryOnly || _summaryOnlyEnvironment;
- final suffix = workspaceRoot.dir == '.' ? '' : ' in `${workspaceRoot.dir}`';
+ final suffix = workspaceRoot.dir == '.'
+ ? ''
+ : ' in `${workspaceRoot.presentationDir}`';
if (enforceLockfile && !fileExists(lockFilePath)) {
throw ApplicationException('''
diff --git a/lib/src/package.dart b/lib/src/package.dart
index 1cf3034..dc21f8c 100644
--- a/lib/src/package.dart
+++ b/lib/src/package.dart
@@ -36,6 +36,13 @@
/// The path to the directory containing the package.
final String dir;
+ /// A version of [dir] adapted for presenting in the terminal.
+ ///
+ /// If [dir] is just a parent directory like ../.. it gets replaced with
+ /// the absolute dir.
+ late String presentationDir =
+ p.isWithin(dir, '.') ? p.normalize(p.absolute(dir)) : dir;
+
/// The name of the package.
String get name => pubspec.name;
diff --git a/test/workspace_test.dart b/test/workspace_test.dart
index d0fa09d..db1056d 100644
--- a/test/workspace_test.dart
+++ b/test/workspace_test.dart
@@ -327,13 +327,16 @@
await pubGet(
environment: {'_PUB_TEST_SDK_VERSION': '3.5.0'},
workingDirectory: p.join(sandbox, appPath, 'pkgs'),
- output: contains('Resolving dependencies in `..`...'),
+ output: contains(
+ 'Resolving dependencies in `${p.join(sandbox, appPath)}`...',
+ ),
);
- final s = p.separator;
await pubGet(
environment: {'_PUB_TEST_SDK_VERSION': '3.5.0'},
workingDirectory: p.join(sandbox, appPath, 'pkgs', 'a'),
- output: contains('Resolving dependencies in `..$s..`...'),
+ output: contains(
+ 'Resolving dependencies in `${p.join(sandbox, appPath)}`...',
+ ),
);
await pubGet(
@@ -351,7 +354,9 @@
appPath,
'pkgs',
),
- output: contains('Resolving dependencies in `..`...'),
+ output: contains(
+ 'Resolving dependencies in `${p.join(sandbox, appPath)}`...',
+ ),
);
});