From 1391a2ffcb13a0dac996528cbe96fe6952ced370 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 9 Feb 2017 16:21:32 +0800 Subject: [PATCH] Use normalizePathSeparators --- source/net/filebot/format/ExpressionFormat.java | 6 +++++- source/net/filebot/util/FileUtilities.java | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/net/filebot/format/ExpressionFormat.java b/source/net/filebot/format/ExpressionFormat.java index 78e4918b..f9d3f971 100644 --- a/source/net/filebot/format/ExpressionFormat.java +++ b/source/net/filebot/format/ExpressionFormat.java @@ -193,7 +193,11 @@ public class ExpressionFormat extends Format { } protected CharSequence normalizeExpressionValue(Object value) { - return value == null ? null : value.toString(); + if (value == null) { + return null; + } + + return normalizePathSeparators(value.toString()); } protected String normalizeResult(CharSequence value) { diff --git a/source/net/filebot/util/FileUtilities.java b/source/net/filebot/util/FileUtilities.java index 4fee35fa..d41a5ada 100644 --- a/source/net/filebot/util/FileUtilities.java +++ b/source/net/filebot/util/FileUtilities.java @@ -630,10 +630,10 @@ public final class FileUtilities { public static String normalizePathSeparators(String path) { // special handling for UNC paths - if (path.startsWith(UNC_PREFIX) && path.length() > 2) { - return UNC_PREFIX + path.substring(2).replace('\\', '/'); + if (path.startsWith(UNC_PREFIX)) { + return UNC_PREFIX + replacePathSeparators(path.substring(UNC_PREFIX.length()), "/"); } - return path.replace('\\', '/'); + return replacePathSeparators(path, "/"); } public static String replacePathSeparators(CharSequence path) {