Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Unified Diff: pkg/analyzer/lib/src/generated/bazel.dart

Issue 2392133002: Fix BazelFileUriResolver tests (Closed)
Patch Set: clean-up Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/bazel_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/bazel.dart
diff --git a/pkg/analyzer/lib/src/generated/bazel.dart b/pkg/analyzer/lib/src/generated/bazel.dart
index debd30081f18494500f6e764b4e0af294db9c456..fc85e29740b4a071bc86bc2fbd85cdc2cfb77c2d 100644
--- a/pkg/analyzer/lib/src/generated/bazel.dart
+++ b/pkg/analyzer/lib/src/generated/bazel.dart
@@ -57,13 +57,11 @@ class BazelFileUriResolver extends ResourceUriResolver {
}
String _getPathFromWorkspaceDir(Uri uri) {
- String uriPath = uri.path;
- String workspacePath = _workspaceDir.path;
-
- if (uriPath.startsWith(workspacePath) &&
- workspacePath.length < uriPath.length) {
- return uriPath.substring(workspacePath.length + 1);
+ try {
+ return provider.pathContext.relative(provider.pathContext.fromUri(uri),
+ from: _workspaceDir.path);
+ } on Exception {
+ return '';
}
- return '';
}
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/bazel_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698