Exemplo n.º 1
0
    std::string URLToPath(const std::string& url)
    {
        Poco::URI inURI = Poco::URI(url);
        try
        {
            if (url == BlankPageURL())
            {
                return BlankURLToFilePath();
            }
            if (inURI.getScheme() == "ti")
            {
                return TiURLToPath(url);
            }
            else if (inURI.getScheme() == "app")
            {
                return AppURLToPath(url);
            }
            else if (inURI.getScheme().empty())
            {
                // There is no scheme for this URL, so we have to/ guess at this point if
                // it's a path or a relative app:// URL. If a file can be found, assume thi
                // is a file path.
                if (FileUtils::IsFile(url))
                    return url;

                // Otherwise treat this like an app:// URL relative to the root.
                std::string newURL("app://");
                newURL.append(url);
                return AppURLToPath(newURL);
            }
        }
        catch (ValueException& e)
        {
            SharedString ss = e.DisplayString();
            Logger* log = Logger::Get("URLUtils");
            log->Error("Could not convert %s to a path: %s", url.c_str(), ss->c_str());
        }
        return url;
    }
Exemplo n.º 2
0
	std::string URLToPath(std::string& url)
	{
		Poco::URI inURI = Poco::URI(url);
		try
		{
			if (inURI.getScheme() == "ti")
			{
				return TiURLToPath(url);
			}
			else if (inURI.getScheme() == "app")
			{
				return AppURLToPath(url);
			}
		}
		catch (ValueException& e)
		{
			SharedString ss = e.DisplayString();
			Logger* log = Logger::Get("URLUtils");
			log->Error("Could not convert %s to a path: %s", url.c_str(), ss->c_str());
		}
		return url;
	}