Index: sdk/lib/_internal/pub/lib/src/io.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/io.dart b/sdk/lib/_internal/pub/lib/src/io.dart |
index 5ae64c2489f7144a13fd7770deca42c64ab16c70..f93f34c6d2eccfb801e5519acf96d8044b2edbfc 100644 |
--- a/sdk/lib/_internal/pub/lib/src/io.dart |
+++ b/sdk/lib/_internal/pub/lib/src/io.dart |
@@ -351,8 +351,11 @@ void createSymlink(String target, String symlink, |
if (Platform.operatingSystem == 'windows') { |
target = path.normalize(path.absolute(target)); |
} else { |
- target = path.normalize( |
- path.relative(target, from: path.dirname(symlink))); |
+ // If the directory where we're creating the symlink was itself reached |
+ // by traversing a symlink, we want the relative path to be relative to |
+ // it's actual location, not the one we went through to get to it. |
+ var symlinkDir = canonicalize(path.dirname(symlink)); |
+ target = path.normalize(path.relative(target, from: symlinkDir)); |
} |
} |