Skip to content

Commit

Permalink
use Path.toString
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Mar 19, 2023
1 parent c166125 commit 82dddaf
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static void acceptDirectory( File directory, ClassFileVisitor visitor )
{

List<Path> classFiles = Files.walk( directory.toPath() )
.filter( path -> path.toFile().getName().endsWith( ".class" ) )
.filter( path -> path.getFileName().toString().endsWith( ".class" ) )
.collect( Collectors.toList() );

for ( Path path : classFiles )
Expand All @@ -122,8 +122,7 @@ private static void acceptDirectory( File directory, ClassFileVisitor visitor )

private static void visitClass( File baseDirectory, Path path, InputStream in, ClassFileVisitor visitor )
{
// getPath() returns a String, not a java.nio.file.Path
String stringPath = path.toFile().getPath().substring( baseDirectory.getPath().length() + 1 );
String stringPath = path.toString().substring( baseDirectory.getPath().length() + 1 );
visitClass( stringPath, in, visitor );
}

Expand Down

0 comments on commit 82dddaf

Please sign in to comment.