From cae5add927b82b5a62ba6689e9cd32dcf63c64ee Mon Sep 17 00:00:00 2001 From: jfrijters Date: Thu, 10 Jun 2010 08:44:40 +0000 Subject: [PATCH] Add feature to expand environment variables in system properties specified with -D ikvmc option. --- ikvmc/CompilerClassLoader.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ikvmc/CompilerClassLoader.cs b/ikvmc/CompilerClassLoader.cs index f72274ff..5ca27279 100644 --- a/ikvmc/CompilerClassLoader.cs +++ b/ikvmc/CompilerClassLoader.cs @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2009 Jeroen Frijters + Copyright (C) 2002-2010 Jeroen Frijters This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -463,6 +463,10 @@ namespace IKVM.Internal ilgen.Emit(OpCodes.Dup); ilgen.Emit(OpCodes.Ldstr, kv.Key); ilgen.Emit(OpCodes.Ldstr, kv.Value); + if(kv.Value.IndexOf('%') < kv.Value.LastIndexOf('%')) + { + ilgen.Emit(OpCodes.Call, JVM.Import(typeof(Environment)).GetMethod("ExpandEnvironmentVariables", new Type[] { Types.String })); + } ilgen.Emit(OpCodes.Callvirt, JVM.Import(typeof(System.Collections.Generic.Dictionary)).GetMethod("Add")); } startupType.GetMethodWrapper("setProperties", "(Lcli.System.Collections.IDictionary;)V", false).EmitCall(ilgen);