From 8b9cc2009392ffcaeaf5861052be84ba9d418fdc Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Sat, 15 Aug 2020 09:05:03 +0300 Subject: [PATCH] Attempt to fix feed unit on windows --- components/common/cpp/src/uri.cpp | 1 + components/streams/src/feed.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/common/cpp/src/uri.cpp b/components/common/cpp/src/uri.cpp index 8885078d8..eb0bc3d1d 100644 --- a/components/common/cpp/src/uri.cpp +++ b/components/common/cpp/src/uri.cpp @@ -68,6 +68,7 @@ void URI::_parse(uri_t puri) { m_host = "none"; m_port = -1; m_proto = SCHEME_NONE; + m_base = suri; m_path = ""; m_frag = ""; } else { diff --git a/components/streams/src/feed.cpp b/components/streams/src/feed.cpp index bc535e545..878497ac5 100644 --- a/components/streams/src/feed.cpp +++ b/components/streams/src/feed.cpp @@ -788,11 +788,11 @@ uint32_t Feed::add(const ftl::URI &uri) { const auto scheme = uri.getScheme(); const std::string group = uri.getAttribute<std::string>("group"); - if ((scheme == ftl::URI::SCHEME_OTHER) || // assumes relative path + if ((scheme == ftl::URI::SCHEME_OTHER) || (scheme == ftl::URI::SCHEME_NONE) || // assumes relative path (scheme == ftl::URI::SCHEME_FILE)) { - auto eix = ((scheme == ftl::URI::SCHEME_OTHER) ? uri.getBaseURI() : uri.getPath()).find_last_of('.'); - auto ext = ((scheme == ftl::URI::SCHEME_OTHER) ? uri.getBaseURI() : uri.getPath()).substr(eix+1); + auto eix = ((scheme == ftl::URI::SCHEME_OTHER || scheme == ftl::URI::SCHEME_NONE) ? uri.getBaseURI() : uri.getPath()).find_last_of('.'); + auto ext = ((scheme == ftl::URI::SCHEME_OTHER || scheme == ftl::URI::SCHEME_NONE) ? uri.getBaseURI() : uri.getPath()).substr(eix+1); if (ext != "ftl") { throw FTL_Error("Bad filename (expects .ftl) : " << uri.getBaseURI()); @@ -802,7 +802,7 @@ uint32_t Feed::add(const ftl::URI &uri) { auto* fstream = ftl::create<ftl::stream::File> (this, std::string("ftlfile-") + std::to_string(file_counter_++)); - if (scheme == ftl::URI::SCHEME_OTHER) { + if (scheme == ftl::URI::SCHEME_OTHER || scheme == ftl::URI::SCHEME_NONE) { fstream->set("filename", uri.getBaseURI()); } else { @@ -952,7 +952,7 @@ uint32_t Feed::add(const ftl::URI &uri) { } } else{ - throw ftl::exception("bad uri"); + throw FTL_Error("Bad feed uri: " << uri.getBaseURI()); } return -1; } -- GitLab