std::string NormalizeURL(std::string& url) { Poco::URI inURI = Poco::URI(url); if (inURI.getScheme() != "app") { return url; } else { return NormalizeAppURL(url); } }
std::string NormalizeURL(const std::string& url) { Poco::URI inURI = Poco::URI(url); if (url == BlankPageURL()) { return url; } if (inURI.getScheme() != "app") { return url; } else { return NormalizeAppURL(url); } }
std::string AppURLToPath(const std::string& inURL) { try { Poco::URI inURI = Poco::URI(inURL); if (inURI.getScheme() != "app") { return inURL; } std::string appURL(NormalizeAppURL(inURL)); inURI = Poco::URI(appURL); SharedApplication app = Host::GetInstance()->GetApplication(); std::string path(app->GetResourcesPath()); std::vector<std::string> segments; inURI.getPathSegments(segments); for (size_t i = 0; i < segments.size(); i++) { path = FileUtils::Join(path.c_str(), segments[i].c_str(), NULL); } return path; } catch (ValueException& e) { SharedString ss = e.DisplayString(); Logger* log = Logger::Get("URLUtils"); log->Error("Could not convert %s to a path: %s", inURL.c_str(), ss->c_str()); } catch (...) { Logger* log = Logger::Get("URLUtils"); log->Error("Could not convert %s to a path", inURL.c_str()); } return inURL; }