[Mono-list] Diff: making machine.config's location variable
Tim Haynes
thaynes@openlinksw.com (Tim Haynes)
Mon, 09 Dec 2002 18:03:06 +0000
--=-=-=
Hi,
One enhancement we've stumbled upon here is the ability to specify the path
to machine.config as an environment variable, overriding (or falling-back
to) the location hard-coded into the binary.
Patch is attached. A suggested ChangeLog entry would be:
2002-12-09 Tim Haynes <thaynes@openlinksw.co.uk>
* mono/jit/jit.c
* mono/metadata/icall.c: added mono_install_get_config_dir() to
utilize the MONO_CFG_DIR environment variable for specifying
different machine.configs.
Cheers,
~Tim
--
OpenLink Software
Tel: +44 (0) 20 8681 7701
Web: <http://www.openlinksw.com>
Universal Data Access & Data Integration Technology Providers
--=-=-=
Content-Disposition: attachment; filename=machine-config-env.diff
Content-Description: implement MONO_CFG_DIR env.variable
Index: mono/jit/jit.c
===================================================================
RCS file: /cvs/public/mono/mono/jit/jit.c,v
retrieving revision 1.266
diff -u -u -r1.266 jit.c
--- mono/jit/jit.c 5 Dec 2002 17:37:09 -0000 1.266
+++ mono/jit/jit.c 9 Dec 2002 17:52:02 -0000
@@ -4224,6 +4224,7 @@
mono_install_handler (arch_get_throw_exception ());
mono_install_runtime_invoke (mono_jit_runtime_invoke);
mono_install_stack_walk (mono_jit_walk_stack);
+ mono_install_get_config_dir ();
domain = mono_init (file);
mono_runtime_init (domain, mono_thread_start_cb,
Index: mono/metadata/icall.c
===================================================================
RCS file: /cvs/public/mono/mono/metadata/icall.c,v
retrieving revision 1.237
diff -u -u -r1.237 icall.c
--- mono/metadata/icall.c 4 Dec 2002 15:04:56 -0000 1.237
+++ mono/metadata/icall.c 9 Dec 2002 17:52:02 -0000
@@ -2999,6 +2999,18 @@
return mono_compile_method (method);
}
+char * mono_cfg_dir = "";
+
+void
+mono_install_get_config_dir()
+{
+ mono_cfg_dir = getenv ("MONO_CFG_DIR");
+
+ if (!mono_cfg_dir)
+ mono_cfg_dir = MONO_CFG_DIR;
+}
+
+
static MonoString *
ves_icall_System_Configuration_DefaultConfig_get_machine_config_path (void)
{
@@ -3010,7 +3022,7 @@
if (mcpath != NULL)
return mcpath;
- path = g_build_path (G_DIR_SEPARATOR_S, MONO_CFG_DIR, "mono", "machine.config", NULL);
+ path = g_build_path (G_DIR_SEPARATOR_S, mono_cfg_dir, "mono", "machine.config", NULL);
#if defined (PLATFORM_WIN32)
/* Avoid mixing '/' and '\\' */
--=-=-=--