From 18a0ffc7e28b1269575cd7d815aad37af1a5c3ba Mon Sep 17 00:00:00 2001 From: Alexandros Naskos Date: Fri, 15 May 2020 13:21:34 +0300 Subject: [PATCH] Check that the zg std library path provided is absolute, default to null otherwise --- src/main.zig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index c08048a..0c0afe7 100644 --- a/src/main.zig +++ b/src/main.zig @@ -634,7 +634,12 @@ pub fn main() anyerror!void { } defer std.json.parseFree(Config, config, config_parse_options); - // @TODO Check is_absolute + if (config.zig_lib_path != null and !std.fs.path.isAbsolute(config.zig_lib_path.?)) { + std.debug.warn("zig library path is not absolute, defaulting to null.\n", .{}); + allocator.free(config.zig_lib_path.?); + config.zig_lib_path = null; + } + try document_store.init(allocator, config.zig_lib_path); defer document_store.deinit();