@@ -353,7 +353,7 @@ class BlazeWorkspace extends Workspace
353
353
if (packageName == null ) {
354
354
return null ;
355
355
}
356
- var package = BlazeWorkspacePackage (packageName, folder.path , this );
356
+ var package = BlazeWorkspacePackage (packageName, folder, this );
357
357
_directoryToPackage[directoryPath] = package;
358
358
return package;
359
359
}
@@ -591,7 +591,7 @@ class BlazeWorkspacePackage extends WorkspacePackage {
591
591
final String _uriPrefix;
592
592
593
593
@override
594
- final String root;
594
+ final Folder root;
595
595
596
596
@override
597
597
final BlazeWorkspace workspace;
@@ -628,9 +628,7 @@ class BlazeWorkspacePackage extends WorkspacePackage {
628
628
629
629
@override
630
630
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);
634
632
}
635
633
636
634
@override
@@ -643,43 +641,38 @@ class BlazeWorkspacePackage extends WorkspacePackage {
643
641
var filePath = filePathFromSource (source);
644
642
if (filePath == null ) return false ;
645
643
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)) {
648
646
// 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);
651
649
}
652
650
653
651
var relativeRoot = workspace.provider.pathContext.relative (
654
- root,
652
+ root.path ,
655
653
from: workspace.root,
656
654
);
657
655
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)) {
664
661
// 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);
670
664
}
671
665
}
672
666
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)) {
679
672
// A file in "$genfiles/lib" is public iff it is not in
680
673
// "$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);
683
676
}
684
677
685
678
return false ;
0 commit comments