Commit c5849187 authored by Eonstorm's avatar Eonstorm
Browse files

Corrected bug identified by issue 17 in google code. The LoadAssembly method...

Corrected bug identified by issue 17 in google code.  The LoadAssembly method should now handle assembly name arguments containing library path strings.


git-svn-id: http://luainterface.googlecode.com/svn/trunk@15 63eb109e-e254-0410-a61e-ed0b8f8614f5
parent bdcc2e93
......@@ -197,30 +197,37 @@ namespace LuaInterface
* if the assembly is not found.
*/
private int loadAssembly(IntPtr luaState)
{
string assemblyName=LuaDLL.lua_tostring(luaState,1);
try
{
Assembly assembly=Assembly.LoadWithPartialName(assemblyName);
{
try
{
string assemblyName=LuaDLL.lua_tostring(luaState,1);
Assembly assembly = null;
try
{
// If we couldn't find it based on a name, see if we can use it as a filename and find it
if (assembly == null)
assembly = Assembly.Load(AssemblyName.GetAssemblyName(assemblyName));
assembly = Assembly.LoadWithPartialName(assemblyName);
}
catch (Exception)
catch (BadImageFormatException)
{
// ignore - it might not even be a filename
// The assemblyName was invalid. It is most likely a path.
}
if(assembly!=null && !assemblies.Contains(assembly))
assemblies.Add(assembly);
}
if (assembly == null)
{
assembly = Assembly.Load(AssemblyName.GetAssemblyName(assemblyName));
}
if (assembly != null && !assemblies.Contains(assembly))
{
assemblies.Add(assembly);
}
}
catch(Exception e)
{
throwError(luaState,e);
}
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment