File tree Expand file tree Collapse file tree 2 files changed +24
-8
lines changed
src/ScriptEngine.HostedScript Expand file tree Collapse file tree 2 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -88,19 +88,15 @@ public static IEngineBuilder UseFileSystemLibraries(this IEngineBuilder b)
8888 entrypoint = typeof ( FileSystemDependencyResolver ) . Assembly ;
8989
9090 sysDir = Path . GetDirectoryName ( entrypoint . Location ) ;
91- searchDirs . Add ( sysDir ) ;
9291 }
93- else
94- {
95- searchDirs . Add ( sysDir ) ;
96- }
97-
92+
9893 if ( libOptions . AdditionalLibraries != null )
9994 {
10095 searchDirs . AddRange ( libOptions . AdditionalLibraries ) ;
10196 }
10297
10398 var resolver = new FileSystemDependencyResolver ( ) ;
99+ resolver . LibraryRoot = sysDir ;
104100 resolver . SearchDirectories . AddRange ( searchDirs ) ;
105101
106102 return resolver ;
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ public class FileSystemDependencyResolver : IDependencyResolver
2424 private readonly List < Library > _libs = new List < Library > ( ) ;
2525 private LibraryLoader _defaultLoader ;
2626 private object _defaultLoaderLocker = new object ( ) ;
27+ private string _libraryRoot ;
2728
2829 #region Private classes
2930
@@ -48,8 +49,27 @@ public FileSystemDependencyResolver()
4849
4950 public IList < string > SearchDirectories { get ; } = new List < string > ( ) ;
5051
51- public string LibraryRoot => SearchDirectories . FirstOrDefault ( ) ?? string . Empty ;
52-
52+ public string LibraryRoot
53+ {
54+ get
55+ {
56+ if ( _libraryRoot == null )
57+ _libraryRoot = Path . GetDirectoryName ( System . Reflection . Assembly . GetExecutingAssembly ( ) . Location ) ;
58+
59+ return _libraryRoot ;
60+ }
61+ set
62+ {
63+ if ( string . IsNullOrWhiteSpace ( value ) )
64+ {
65+ _libraryRoot = null ;
66+ }
67+
68+ _libraryRoot = value ;
69+ }
70+ }
71+
72+
5373 private ScriptingEngine Engine { get ; set ; }
5474
5575 public void Initialize ( ScriptingEngine engine )
You can’t perform that action at this time.
0 commit comments