From fec34c2f70ce333c08d51388d48db8b53ef24dcf Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 5 Mar 2025 18:27:17 +0000 Subject: [PATCH] Fixes --- core/src/main/java/io/xpipe/core/store/FilePath.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/io/xpipe/core/store/FilePath.java b/core/src/main/java/io/xpipe/core/store/FilePath.java index 53efb113b..d6327c2c5 100644 --- a/core/src/main/java/io/xpipe/core/store/FilePath.java +++ b/core/src/main/java/io/xpipe/core/store/FilePath.java @@ -33,6 +33,8 @@ public final class FilePath { @NonNull private final String value; + private FilePath normalized; + private FilePath(@NonNull String value) { this.value = value; if (value.isBlank()) { @@ -193,8 +195,14 @@ public final class FilePath { } public FilePath normalize() { + if (normalized != null) { + return normalized; + } + var backslash = value.contains("\\"); - return backslash ? toWindows() : toUnix(); + var r = backslash ? toWindows() : toUnix(); + normalized = r; + return r; } public FilePath resolveTildeHome(String dir) {