Skip to content

Commit 699b26d

Browse files
authored
Stop using JavaFile. (#2856)
1 parent 520e649 commit 699b26d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/src/model/package_builder.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import 'package:analyzer/src/dart/sdk/sdk.dart'
1919
// ignore: implementation_imports
2020
import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
2121
// ignore: implementation_imports
22-
import 'package:analyzer/src/generated/java_io.dart' show JavaFile;
23-
// ignore: implementation_imports
2422
import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
2523
import 'package:dartdoc/src/dartdoc_options.dart';
2624
import 'package:dartdoc/src/logging.dart';
@@ -149,16 +147,18 @@ class PubPackageBuilder implements PackageBuilder {
149147
/// If [filePath] is not a library, returns null.
150148
Future<DartDocResolvedLibrary> processLibrary(String filePath) async {
151149
var name = filePath;
152-
var directoryCurrentPath = resourceProvider.pathContext.current;
150+
var pathContext = resourceProvider.pathContext;
151+
var directoryCurrentPath = pathContext.current;
153152

154153
if (name.startsWith(directoryCurrentPath)) {
155154
name = name.substring(directoryCurrentPath.length);
156-
if (name.startsWith(resourceProvider.pathContext.separator)) {
155+
if (name.startsWith(pathContext.separator)) {
157156
name = name.substring(1);
158157
}
159158
}
160-
var javaFile = JavaFile(filePath).getAbsoluteFile();
161-
filePath = javaFile.getPath();
159+
160+
// TODO(scheglov) Do we need this? Maybe the argument is already valid?
161+
filePath = pathContext.normalize(pathContext.absolute(filePath));
162162

163163
var analysisContext = contextCollection.contextFor(config.inputDir);
164164
var session = analysisContext.currentSession;

0 commit comments

Comments
 (0)