Skip to content

Commit b72735a

Browse files
authored
[mono] Add a --path command line argument as an alternative to MONO_PATH. (#90544)
Can be specified multiple times.
1 parent 99a60c6 commit b72735a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/mono/mono/mini/driver.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,7 @@ mini_usage (void)
16171617
#endif
16181618
" --handlers Install custom handlers, use --help-handlers for details.\n"
16191619
" --aot-path=PATH List of additional directories to search for AOT images.\n"
1620+
" --path=DIR Add DIR to the list of directories to search for assemblies.\n"
16201621
);
16211622

16221623
g_print ("\nOptions:\n");
@@ -2069,6 +2070,7 @@ mono_main (int argc, char* argv[])
20692070
char *aot_options = NULL;
20702071
GPtrArray *agents = NULL;
20712072
char *extra_bindings_config_file = NULL;
2073+
GList *paths = NULL;
20722074
#ifdef MONO_JIT_INFO_TABLE_TEST
20732075
int test_jit_info_table = FALSE;
20742076
#endif
@@ -2294,6 +2296,8 @@ mono_main (int argc, char* argv[])
22942296
g_free (tmp);
22952297
split++;
22962298
}
2299+
} else if (strncmp (argv [i], "--path=", 7) == 0) {
2300+
paths = g_list_append (paths, argv [i] + 7);
22972301
} else if (strncmp (argv [i], "--compile-all=", 14) == 0) {
22982302
action = DO_COMPILE;
22992303
recompilation_times = atoi (argv [i] + 14);
@@ -2503,6 +2507,16 @@ mono_main (int argc, char* argv[])
25032507
if (g_hasenv ("MONO_XDEBUG"))
25042508
enable_debugging = TRUE;
25052509

2510+
if (paths) {
2511+
char **p = g_new0 (char *, g_list_length (paths) + 1);
2512+
int pindex = 0;
2513+
for (GList *l = paths; l; l = l->next)
2514+
p [pindex ++] = (char*)l->data;
2515+
g_list_free (paths);
2516+
2517+
mono_set_assemblies_path_direct (p);
2518+
}
2519+
25062520
#ifdef MONO_CROSS_COMPILE
25072521
if (!mono_compile_aot) {
25082522
fprintf (stderr, "This mono runtime is compiled for cross-compiling. Only the --aot option is supported.\n");

0 commit comments

Comments
 (0)