aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/console.c')
-rw-r--r--tools/console.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/console.c b/tools/console.c
index f6a15ecb..c187f500 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -4,6 +4,8 @@
#include "console.h"
#include "serd/serd.h"
+#include "zix/allocator.h"
+#include "zix/filesystem.h"
#ifdef _WIN32
# ifdef _MSC_VER
@@ -43,6 +45,24 @@ serd_print_version(const char* const program)
return 0;
}
+SerdStatus
+serd_set_base_uri_from_path(SerdEnv* const env, const char* const path)
+{
+ char* const input_path = zix_canonical_path(NULL, path);
+ if (!input_path) {
+ return SERD_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);
+ zix_free(NULL, input_path);
+
+ return SERD_SUCCESS;
+}
+
/// Wrapper for getc that is compatible with SerdReadFunc but faster than fread
static size_t
serd_file_read_byte(void* buf, size_t size, size_t nmemb, void* stream)