| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analyzer.src.generated.bazel; | 5 library analyzer.src.generated.bazel; |
| 6 | 6 |
| 7 import 'dart:core'; | 7 import 'dart:core'; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 for (Folder buildDir in _buildDirectories) { | 50 for (Folder buildDir in _buildDirectories) { |
| 51 File file = buildDir.getChildAssumingFile(relativeFromWorkspaceDir); | 51 File file = buildDir.getChildAssumingFile(relativeFromWorkspaceDir); |
| 52 if (file.exists) { | 52 if (file.exists) { |
| 53 return file.createSource(actualUri ?? uri); | 53 return file.createSource(actualUri ?? uri); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 return null; | 56 return null; |
| 57 } | 57 } |
| 58 | 58 |
| 59 String _getPathFromWorkspaceDir(Uri uri) { | 59 String _getPathFromWorkspaceDir(Uri uri) { |
| 60 String uriPath = uri.path; | 60 try { |
| 61 String workspacePath = _workspaceDir.path; | 61 return provider.pathContext.relative(provider.pathContext.fromUri(uri), |
| 62 | 62 from: _workspaceDir.path); |
| 63 if (uriPath.startsWith(workspacePath) && | 63 } on Exception { |
| 64 workspacePath.length < uriPath.length) { | 64 return ''; |
| 65 return uriPath.substring(workspacePath.length + 1); | |
| 66 } | 65 } |
| 67 return ''; | |
| 68 } | 66 } |
| 69 } | 67 } |
| OLD | NEW |