diff options
author | David Robillard <d@drobilla.net> | 2023-05-02 00:48:29 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-05-02 16:24:03 -0400 |
commit | 4e72044bbd2776ccac6f8cb56fc0e744cc9730c0 (patch) | |
tree | 60982c8f108e36de92ded5068286cdb28dd43f60 | |
parent | 8035015f9e583f483279d306b9bae6096c0bd357 (diff) | |
download | ingen-4e72044bbd2776ccac6f8cb56fc0e744cc9730c0.tar.gz ingen-4e72044bbd2776ccac6f8cb56fc0e744cc9730c0.tar.bz2 ingen-4e72044bbd2776ccac6f8cb56fc0e744cc9730c0.zip |
Fix relative URI creation with newer serd
-rw-r--r-- | include/ingen/URI.hpp | 1 | ||||
-rw-r--r-- | src/Parser.cpp | 2 | ||||
-rw-r--r-- | src/URI.cpp | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/include/ingen/URI.hpp b/include/ingen/URI.hpp index c344e7c2..a45fb268 100644 --- a/include/ingen/URI.hpp +++ b/include/ingen/URI.hpp @@ -52,6 +52,7 @@ public: ~URI(); URI make_relative(const URI& base) const; + URI make_relative(const URI& base, const URI& root) const; bool empty() const { return !_node.buf; } diff --git a/src/Parser.cpp b/src/Parser.cpp index c66f852d..89e23274 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -91,7 +91,7 @@ Parser::find_resources(Sord::World& world, static std::optional<raul::Path> get_path(const URI& base, const URI& uri) { - const URI relative = uri.make_relative(base); + const URI relative = uri.make_relative(base, base); const std::string uri_str = "/" + relative.string(); return raul::Path::is_valid(uri_str) ? raul::Path(uri_str) : std::optional<raul::Path>(); diff --git a/src/URI.cpp b/src/URI.cpp index 501b4eb9..c4020c4d 100644 --- a/src/URI.cpp +++ b/src/URI.cpp @@ -125,4 +125,14 @@ URI::make_relative(const URI& base) const return {node, uri}; } +URI +URI::make_relative(const URI& base, const URI& root) const +{ + SerdURI uri; + const SerdNode node = + serd_node_new_relative_uri(&_uri, &base._uri, &root._uri, &uri); + + return {node, uri}; +} + } // namespace ingen |