Skip to content

Commit 5f2d594

Browse files
committed
env: C2_PLUGINDIR now supports multiple paths (: separated)
1 parent e80b1d4 commit 5f2d594

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

compiler/main.c2

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,7 @@ fn void Context.handle_args(Context* c, i32 argc, char** argv) {
504504
}
505505
} else {
506506
const char* plugin_dir = getenv("C2_PLUGINDIR");
507-
if (plugin_dir) {
508-
u32 path_name = c.auxPool.addStr(plugin_dir, true);
509-
c.plugins.addPath(path_name);
510-
}
507+
if (plugin_dir) string_utils.split_paths(plugin_dir, c, on_plugin_dir);
511508
}
512509

513510
c.comp_opts.libdir = getenv("C2_LIBDIR");
@@ -516,6 +513,12 @@ fn void Context.handle_args(Context* c, i32 argc, char** argv) {
516513
}
517514
}
518515

516+
fn void on_plugin_dir(void* arg, const char* path, u32 size) {
517+
Context* c = arg;
518+
u32 path_idx = c.auxPool.add(path, size, true);
519+
c.plugins.addPath(path_idx);
520+
}
521+
519522
fn void Context.handle_plugins(Context* c) {
520523
if (c.opts.show_plugins) {
521524
c.plugins.show();

0 commit comments

Comments
 (0)