Skip to content

Commit

Permalink
#204 fixed current file printing
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 14, 2024
1 parent 6d90f0b commit 6eabf02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/jcabi/log/FileDecor.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public void formatTo(final Formatter formatter, final int flags,
if (rel.startsWith("..")) {
rel = self.toString();
}
if (rel.isEmpty()) {
rel = "./";
}
writer.write(rel);
}
formatter.format("%s", writer);
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/jcabi/log/FileDecorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ private static Collection<Object[]> params() {
new Object[][] {
{null, "NULL", 0, 0, 0},
{"foo.txt", "foo.txt", 0, 0, 0},
{".", "./", 0, 0, 0},
{"/tmp", "/tmp", 0, 0, 0},
{new File("/tmp/x.txt"), "/tmp/x.txt", 0, 0, 0},
{Paths.get("/a/b/c.txt"), "/a/b/c.txt", 0, 0, 0},
}
Expand Down

0 comments on commit 6eabf02

Please sign in to comment.