mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-04-27 17:04:44 +00:00
Fixed URL detection in PresetFactory
This commit is contained in:
@ -2,28 +2,19 @@
|
||||
|
||||
const std::string PresetFactory::IDLE_PRESET_PROTOCOL("idle");
|
||||
|
||||
std::string PresetFactory::Protocol(const std::string& url, std::string& path) {
|
||||
std::string PresetFactory::Protocol(const std::string& url, std::string& path)
|
||||
{
|
||||
auto pos = url.find("://");
|
||||
|
||||
#ifdef __APPLE__
|
||||
// NOTE: Brian changed this from url.find_first_of to url.find, since presumably we want to find the first occurence of
|
||||
// :// and not the first occurence of any colon or forward slash. At least that fixed a bug in the Mac OS X build.
|
||||
std::size_t pos = url.find("://");
|
||||
#else
|
||||
std::size_t pos = url.find_first_of("://");
|
||||
#endif
|
||||
if (pos == std::string::npos)
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
path = url;
|
||||
return std::string();
|
||||
return {};
|
||||
}
|
||||
else
|
||||
{
|
||||
path = url.substr(pos + 3, url.length());
|
||||
|
||||
path = url.substr(pos + 3, url.length());
|
||||
#ifdef DEBUG
|
||||
std::cout << "[PresetFactory] Filename is URL: " << url << std::endl;
|
||||
std::cout << "[PresetFactory] Filename is URL: " << url << std::endl;
|
||||
#endif
|
||||
return url.substr(0, pos);
|
||||
}
|
||||
|
||||
return url.substr(0, pos);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user