Skip to content

Commit

Permalink
#175 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 27, 2023
1 parent c2662f7 commit 7c50ea8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/java/com/jcabi/log/FileDecor.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,13 @@ public void formatTo(final Formatter formatter, final int flags,
} else {
final Path self = Paths.get(this.path.toString()).toAbsolutePath();
final Path root = Paths.get("").toAbsolutePath();
String rel = root.relativize(self).toString();
Path rlt;
try {
rlt = root.relativize(self);
} catch (final IllegalArgumentException ex) {
rlt = self;
}
String rel = rlt.toString();
if (rel.startsWith("..")) {
rel = self.toString();
}
Expand Down

0 comments on commit 7c50ea8

Please sign in to comment.