Skip to content

Commit

Permalink
relativize gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn committed Dec 28, 2024
1 parent 65d3506 commit f71b937
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/mcp/mobius/waila/config/PluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,16 @@ public enum PluginConfig implements IPluginConfig {
if (language.has(descKey)) sb.append('\n').append(language.getOrDefault(descKey));

if (type.equals(ConfigEntry.PATH)) {
var configPath = (Path) entry.getDefaultValue();
var parentPath = PATH.getParent().toAbsolutePath();
var configPath = ((Path) entry.getDefaultValue()).toAbsolutePath();
try {
configPath = parentPath.relativize(configPath);
} catch (IllegalArgumentException e) {
// no-op
}

sb.append("\n").append(language.getOrDefault(Tl.Json5.Config.Plugin.CUSTOM_FILE));
sb.append("\n").append(PATH.getParent().relativize(configPath));
sb.append("\n").append(configPath);
return sb.toString();
}

Expand Down

0 comments on commit f71b937

Please sign in to comment.