3
3
using System . Collections . Generic ;
4
4
using System . IO ;
5
5
using System . Linq ;
6
+ using System . Reflection ;
6
7
using System . Threading ;
7
8
using Unity . CompilationPipeline . Common . ILPostProcessing ;
8
9
@@ -16,7 +17,7 @@ public class PostProcessorAssemblyResolver : BaseAssemblyResolver
16
17
[
17
18
"FishNet.Runtime.dll"
18
19
] ;
19
-
20
+
20
21
private readonly string [ ] m_AssemblyReferences ;
21
22
private readonly Dictionary < string , AssemblyDefinition > m_AssemblyCache = new Dictionary < string , AssemblyDefinition > ( ) ;
22
23
private readonly ICompiledAssembly m_CompiledAssembly ;
@@ -34,7 +35,7 @@ public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderPar
34
35
{
35
36
if ( name . Name == "mscorlib" || name . Name == "netstandard" )
36
37
return base . Resolve ( name , parameters ) ;
37
-
38
+
38
39
lock ( m_AssemblyCache )
39
40
{
40
41
if ( name . Name == m_CompiledAssembly . Name )
@@ -50,12 +51,12 @@ public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderPar
50
51
fileName = ResolveAssemblyPath ( $ "{ name . Name } .dll") ;
51
52
pathResolved = true ;
52
53
}
53
-
54
+
54
55
if ( fileName == null )
55
56
{
56
57
return base . Resolve ( name , parameters ) ;
57
58
}
58
-
59
+
59
60
// Try to resolve absolute file path to assembly
60
61
if ( ! pathResolved )
61
62
fileName = ResolveAssemblyPath ( fileName ) ;
@@ -89,7 +90,10 @@ private string ResolveAssemblyPath(string assemblyPath)
89
90
return assemblyPath ;
90
91
91
92
if ( IgnoreResolveAssemblies . Contains ( assemblyPath ) )
92
- return assemblyPath ;
93
+ {
94
+ var currentDirectory = Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) ;
95
+ return Path . Combine ( currentDirectory ! , assemblyPath ) ;
96
+ }
93
97
94
98
foreach ( var searchPath in AssemblySearchPaths )
95
99
{
@@ -179,4 +183,4 @@ public void AddAssemblyDefinitionBeingOperatedOn(AssemblyDefinition assemblyDefi
179
183
m_SelfAssembly = assemblyDefinition ;
180
184
}
181
185
}
182
- }
186
+ }
0 commit comments