diff --git a/modules/juce_core/files/juce_File.cpp b/modules/juce_core/files/juce_File.cpp index 51dd5bb484..7041ecd886 100644 --- a/modules/juce_core/files/juce_File.cpp +++ b/modules/juce_core/files/juce_File.cpp @@ -111,10 +111,17 @@ static String normaliseSeparators (const String& path) String separator (File::getSeparatorString()); String doubleSeparator (separator + separator); + auto uncPath = normalisedPath.startsWith (doubleSeparator) + && ! normalisedPath.fromFirstOccurrenceOf (doubleSeparator, false, false).startsWith (separator); + + if (uncPath) + normalisedPath = normalisedPath.fromFirstOccurrenceOf (doubleSeparator, false, false); + while (normalisedPath.contains (doubleSeparator)) normalisedPath = normalisedPath.replace (doubleSeparator, separator); - return normalisedPath; + return uncPath ? doubleSeparator + normalisedPath + : normalisedPath; } bool File::isRoot() const