MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / fileFromFileSchemeURL

Method fileFromFileSchemeURL

JUCE/modules/juce_core/network/juce_URL.cpp:380–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

378#endif
379
380File URL::fileFromFileSchemeURL (const URL& fileURL)
381{
382 if (! fileURL.isLocalFile())
383 {
384 jassertfalse;
385 return {};
386 }
387
388 auto path = removeEscapeChars (fileURL.getDomainInternal (true)).replace ("+", "%2B");
389
390 #if JUCE_WINDOWS
391 bool isUncPath = (! fileURL.url.startsWith ("file:///"));
392 #else
393 path = File::getSeparatorString() + path;
394 #endif
395
396 auto urlElements = StringArray::fromTokens (fileURL.getSubPath(), "/", "");
397
398 for (auto urlElement : urlElements)
399 path += File::getSeparatorString() + removeEscapeChars (urlElement.replace ("+", "%2B"));
400
401 #if JUCE_WINDOWS
402 if (isUncPath)
403 path = "\\\\" + path;
404 #endif
405
406 return path;
407}
408
409int URL::getPort() const
410{

Callers

nothing calls this directly

Calls 5

getDomainInternalMethod · 0.80
getSubPathMethod · 0.80
isLocalFileMethod · 0.45
replaceMethod · 0.45
startsWithMethod · 0.45

Tested by

no test coverage detected