diff options
Diffstat (limited to 'src/console.c')
-rw-r--r-- | src/console.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/console.c b/src/console.c index 3d2c110a..2cc908ef 100644 --- a/src/console.c +++ b/src/console.c @@ -91,3 +91,21 @@ serd_open_output(const char* const filename, const size_t page_size) return serd_byte_sink_new_filename(filename, page_size); } + +SerdStatus +serd_set_base_uri_from_path(SerdEnv* const env, const char* const path) +{ + char* const input_path = serd_canonical_path(path); + if (!input_path) { + return SERD_ERR_BAD_ARG; + } + + SerdNode* const file_uri = + serd_new_file_uri(SERD_STRING(input_path), SERD_EMPTY_STRING()); + + serd_env_set_base_uri(env, serd_node_string_view(file_uri)); + serd_node_free(file_uri); + serd_free(input_path); + + return SERD_SUCCESS; +} |