@@ -353,7 +353,7 @@ class BlazeWorkspace extends Workspace
353353 if (packageName == null ) {
354354 return null ;
355355 }
356- var package = BlazeWorkspacePackage (packageName, folder.path , this );
356+ var package = BlazeWorkspacePackage (packageName, folder, this );
357357 _directoryToPackage[directoryPath] = package;
358358 return package;
359359 }
@@ -591,7 +591,7 @@ class BlazeWorkspacePackage extends WorkspacePackage {
591591 final String _uriPrefix;
592592
593593 @override
594- final String root;
594+ final Folder root;
595595
596596 @override
597597 final BlazeWorkspace workspace;
@@ -628,9 +628,7 @@ class BlazeWorkspacePackage extends WorkspacePackage {
628628
629629 @override
630630 bool isInTestDirectory (File file) {
631- var resourceProvider = workspace.provider;
632- var packageRoot = resourceProvider.getFolder (root);
633- return packageRoot.getChildAssumingFolder ('test' ).contains (file.path);
631+ return root.getChildAssumingFolder ('test' ).contains (file.path);
634632 }
635633
636634 @override
@@ -643,43 +641,38 @@ class BlazeWorkspacePackage extends WorkspacePackage {
643641 var filePath = filePathFromSource (source);
644642 if (filePath == null ) return false ;
645643
646- var libFolder = workspace.provider.pathContext. join (root, 'lib' );
647- if (workspace.provider.pathContext. isWithin (libFolder, filePath)) {
644+ var libFolder = root. getChildAssumingFolder ( 'lib' );
645+ if (libFolder. contains ( filePath)) {
648646 // A file in "$root/lib" is public iff it is not in "$root/lib/src".
649- var libSrcFolder = workspace.provider.pathContext. join (libFolder, 'src' );
650- return ! workspace.provider.pathContext. isWithin (libSrcFolder, filePath);
647+ var libSrcFolder = libFolder. getChildAssumingFolder ( 'src' );
648+ return ! libSrcFolder. contains ( filePath);
651649 }
652650
653651 var relativeRoot = workspace.provider.pathContext.relative (
654- root,
652+ root.path ,
655653 from: workspace.root,
656654 );
657655 for (var binPath in workspace.binPaths) {
658- libFolder = workspace.provider.pathContext.join (
659- binPath,
660- relativeRoot,
661- 'lib' ,
662- );
663- if (workspace.provider.pathContext.isWithin (libFolder, filePath)) {
656+ Folder bin = workspace.provider.getFolder (binPath);
657+ libFolder = bin
658+ .getChildAssumingFolder (relativeRoot)
659+ .getChildAssumingFolder ('lib' );
660+ if (libFolder.contains (filePath)) {
664661 // A file in "$bin/lib" is public iff it is not in "$bin/lib/src".
665- var libSrcFolder = workspace.provider.pathContext.join (
666- libFolder,
667- 'src' ,
668- );
669- return ! workspace.provider.pathContext.isWithin (libSrcFolder, filePath);
662+ var libSrcFolder = libFolder.getChildAssumingFolder ('src' );
663+ return ! libSrcFolder.contains (filePath);
670664 }
671665 }
672666
673- libFolder = workspace.provider.pathContext.join (
674- workspace.genfiles,
675- relativeRoot,
676- 'lib' ,
677- );
678- if (workspace.provider.pathContext.isWithin (libFolder, filePath)) {
667+ libFolder = workspace.provider
668+ .getFolder (workspace.genfiles)
669+ .getChildAssumingFolder (relativeRoot)
670+ .getChildAssumingFolder ('lib' );
671+ if (libFolder.contains (filePath)) {
679672 // A file in "$genfiles/lib" is public iff it is not in
680673 // "$genfiles/lib/src".
681- var libSrcFolder = workspace.provider.pathContext. join (libFolder, 'src' );
682- return ! workspace.provider.pathContext. isWithin (libSrcFolder, filePath);
674+ var libSrcFolder = libFolder. getChildAssumingFolder ( 'src' );
675+ return ! libSrcFolder. contains ( filePath);
683676 }
684677
685678 return false ;
0 commit comments