File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -330,8 +330,17 @@ class Library extends ModelElement
330
330
String get _importPath {
331
331
// This code should not be used for Dart SDK libraries.
332
332
assert (! element.source.uri.isScheme ('dart' ));
333
- var relativePath = pathContext.relative (element.source.fullName,
334
- from: package.packagePath);
333
+ var fullName = element.source.fullName;
334
+ if (! pathContext.isWithin (fullName, package.packagePath) &&
335
+ package.packagePath.contains ('/google3/' )) {
336
+ // In google3, `fullName` is specified as if the root of google3 was `/`.
337
+ // And `package.packagePath` contains the true google3 root.
338
+ var root = pathContext
339
+ .joinAll (pathContext.split (package.packagePath)..removeLast ());
340
+ fullName = '$root $fullName ' ;
341
+ }
342
+ var relativePath =
343
+ pathContext.relative (fullName, from: package.packagePath);
335
344
assert (relativePath.startsWith ('lib${pathContext .separator }' ));
336
345
const libDirectoryLength = 'lib/' .length;
337
346
return relativePath.substring (libDirectoryLength);
You can’t perform that action at this time.
0 commit comments