From: Alexis Christoforides Date: Wed, 9 Dec 2015 23:05:32 +0000 (-0500) Subject: [mkbundle] Allow overriding linked Mono library path X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=48cf6194d0a7731210e09c29e4e9ebbe8df6358b;p=mono.git [mkbundle] Allow overriding linked Mono library path --- diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs index 89bab52384c..e24b924e761 100755 --- a/mcs/tools/mkbundle/mkbundle.cs +++ b/mcs/tools/mkbundle/mkbundle.cs @@ -495,11 +495,11 @@ void mono_register_config_for_assembly (const char* assembly_name, cons if (static_link) { compilerArgs.Add("/MT"); - monoFile = monoPath + @"\lib\mono-2.0.lib"; + monoFile = LocateFile (monoPath + @"\lib\mono-2.0.lib"); } else { compilerArgs.Add("/MD"); - monoFile = monoPath + @"\lib\mono-2.0.dll"; + monoFile = LocateFile (monoPath + @"\lib\mono-2.0.dll"); } compilerArgs.Add(temp_c); @@ -835,4 +835,15 @@ void mono_register_config_for_assembly (const char* assembly_name, cons } return val; } + + static string LocateFile(string default_path) + { + var override_path = Path.Combine(Directory.GetCurrentDirectory(), Path.GetFileName(default_path)); + if (File.Exists(override_path)) + return override_path; + else if (File.Exists(default_path)) + return default_path; + else + throw new FileNotFoundException(default_path); + } }