Skip to content

Commit

Permalink
Merge pull request #653 from mP1/feature/TreeLogger-missed-StringPath…
Browse files Browse the repository at this point in the history
…-parse-sanity-fix

TreeLogger missed StringPath.parse sanity fix
  • Loading branch information
mP1 authored Jul 3, 2023
2 parents 77e6cb9 + 35a923d commit 8d1cb8f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/main/java/walkingkooka/j2cl/maven/log/TreeLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,13 @@ public void paths(final String label,
}

private StringPath toStringPath(final J2clPath path) {
return StringPath.parse(
return toStringPath(
path.path()
.toString()
.replace(File.separatorChar, '/')
.replace(
File.separatorChar,
'/'
)
);
}

Expand All @@ -174,9 +177,24 @@ public void fileInfos(final String label,
}

private StringPath toStringPath(final FileInfo fileInfo) {
final String targetPath = fileInfo.targetPath().replace(File.separatorChar, '/');
return toStringPath(
fileInfo.targetPath()
.replace(
File.separatorChar,
'/'
)
);
}

return StringPath.parse(targetPath.startsWith("/") ? targetPath : "/" + targetPath);
/**
* Converts the path into a unix style path, adding a leading slash if necessary.
* The actual value is not used to fetch any path from disk, its only used for sorting and pretty printing.
*/
private StringPath toStringPath(final String path) {
return StringPath.parse(
path.startsWith("/") ?
path :
"/" + path);
}

private <T> void stringPath(final String label,
Expand Down

0 comments on commit 8d1cb8f

Please sign in to comment.