1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

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

This commit is contained in:
ed 2019-12-02 10:58:59 +00:00
parent a8e592d8a8
commit c898376158

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