static void testExpandPathname(void) { if (stringEqual(getDirectoryPathSeparator(), "/")) { test(expandPathname("a/b"), "a/b"); test(expandPathname("a\\b"), "a/b"); } else { test(expandPathname("a/b"), "a\\b"); test(expandPathname("a\\b"), "a\\b"); } }
void iurlstream::open(std::string url) { if (url.empty()) { url = m_url; } // download the entire URL to a temp file, put into stringbuf for reading std::string tempDir = getTempDirectory(); std::string filename = getUrlFilename(url); m_tempFilePath = tempDir + getDirectoryPathSeparator() + filename; m_lastError = pp->url_download(url, filename); if (m_lastError == ERR_MALFORMED_URL) { error("iurlstream::open: malformed URL when downloading " + url + " to " + m_tempFilePath); } else if (m_lastError == ERR_IO_EXCEPTION) { error("iurlstream::open: network I/O error when downloading " + url + " to " + m_tempFilePath); } if (m_lastError == 200) { std::ifstream::open(m_tempFilePath.c_str()); } else { setstate(std::ios::failbit); } }