Browse Source

Check for UNC paths when normalising separators in File::parseAbsolutePath()

tags/2021-05-28
ed 5 years ago
parent
commit
c898376158
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      modules/juce_core/files/juce_File.cpp

+ 8
- 1
modules/juce_core/files/juce_File.cpp View File

@@ -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


Loading…
Cancel
Save