From 7df5bc00172fe3d1394db7fb07f92e6c67e8d4bf Mon Sep 17 00:00:00 2001 From: Pierre-Nicolas Clauss Date: Sun, 15 Oct 2023 16:32:43 +0200 Subject: [PATCH] Add more paths to search for the standard library Module `std` is searched first in a `c3` subdirectory. Search directories are, in order and relative to the compiler executable location: - `lib/c3` relative to the parent directory - `lib` relative to the parent directory - `/lib/c3` - `/lib` - `/c3` - `/` - `c3` relative to the parent directory - the parent directory - `lib/c3` relative to the grand-parent directory - `lib` relative to the grand-parent directory --- src/utils/file_utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils/file_utils.c b/src/utils/file_utils.c index e862c0bc2..6d9f9cc81 100644 --- a/src/utils/file_utils.c +++ b/src/utils/file_utils.c @@ -381,10 +381,15 @@ const char *find_lib_dir(void) path[strlen_path - 1] = '\0'; } const char *lib_path = NULL; + if ((lib_path = lib_find(path, "/../lib/c3"))) goto DONE; if ((lib_path = lib_find(path, "/../lib/"))) goto DONE; + if ((lib_path = lib_find(path, "/lib/c3"))) goto DONE; if ((lib_path = lib_find(path, "/lib/"))) goto DONE; + if ((lib_path = lib_find(path, "/c3"))) goto DONE; if ((lib_path = lib_find(path, "/"))) goto DONE; + if ((lib_path = lib_find(path, "/../c3"))) goto DONE; if ((lib_path = lib_find(path, "/../"))) goto DONE; + if ((lib_path = lib_find(path, "/../../lib/c3"))) goto DONE; if ((lib_path = lib_find(path, "/../../lib/"))) goto DONE; DEBUG_LOG("Could not find the standard library /lib/std/");