Skip to content

Commit

Permalink
canonicalize before examining parents (gets rid of /.)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm committed Oct 25, 2024
1 parent 7679721 commit f8ee397
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/src/package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,17 @@ See $workspacesDocUrl for more information.
verifyLink(resolvedDir);

{
final symlinkResolvedDir = symlinkResolvedDirs[resolvedDir] ??=
Directory(resolvedDir).resolveSymbolicLinksSync();

for (final parent in parentDirs(p.dirname(resolvedDir))) {
final canonicalized = p.canonicalize(resolvedDir);
final symlinkResolvedDir = symlinkResolvedDirs[canonicalized] ??=
Directory(canonicalized).resolveSymbolicLinksSync();
for (final parent in parentDirs(p.dirname(canonicalized))) {
final symlinkResolvedParent = symlinkResolvedDirs[parent] ??=
Directory(parent).resolveSymbolicLinksSync();
if (p.equals(symlinkResolvedDir, symlinkResolvedParent)) {
dataError('''
Pub does not support symlink cycles.
$resolvedDir => ${p.canonicalize(parent)}
$symlinkResolvedDir => ${p.canonicalize(symlinkResolvedParent)}
''');
}
}
Expand Down

0 comments on commit f8ee397

Please sign in to comment.