Skip to content

Commit 11a7450

Browse files
committed
Remove CurrentAssemblyDirectory
1 parent 968291f commit 11a7450

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88

99
### Added
1010
- Ninject for .NET Core can now load extensions automatically
11-
- The executing assembly's directory is considered as one of the base directories
1211

1312
## [3.3.1] - 2017-10-05
1413

src/Ninject/Modules/ModuleLoader.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ namespace Ninject.Modules
1212
using System.Collections.Generic;
1313
using System.IO;
1414
using System.Linq;
15-
using System.Reflection;
1615
using Ninject.Components;
1716
using Ninject.Infrastructure;
1817

@@ -21,8 +20,6 @@ namespace Ninject.Modules
2120
/// </summary>
2221
public class ModuleLoader : NinjectComponent, IModuleLoader
2322
{
24-
private static readonly string CurrentAssemblyDirectory = Path.GetDirectoryName(new Uri(typeof(ModuleLoader).Assembly.CodeBase).LocalPath);
25-
2623
/// <summary>
2724
/// Initializes a new instance of the <see cref="ModuleLoader"/> class.
2825
/// </summary>
@@ -56,8 +53,15 @@ public void LoadModules(IEnumerable<string> patterns)
5653
var extension = fileGroup.Key;
5754
var plugin = plugins.Where(p => p.SupportedExtensions.Contains(extension)).FirstOrDefault();
5855

56+
Console.WriteLine(fileGroup.Key);
57+
5958
if (plugin != null)
6059
{
60+
foreach (var f in fileGroup)
61+
{
62+
Console.WriteLine(f);
63+
}
64+
6165
plugin.LoadModules(fileGroup);
6266
}
6367
}
@@ -79,14 +83,13 @@ private static IEnumerable<string> NormalizePaths(string path)
7983

8084
private static IEnumerable<string> GetBaseDirectories()
8185
{
82-
var baseDirectory = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
86+
var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
8387
var searchPath = AppDomain.CurrentDomain.RelativeSearchPath;
8488

85-
return (string.IsNullOrEmpty(searchPath)
89+
return string.IsNullOrEmpty(searchPath)
8690
? new[] { baseDirectory }
8791
: searchPath.Split(new[] { Path.PathSeparator }, StringSplitOptions.RemoveEmptyEntries)
88-
.Select(path => Path.Combine(baseDirectory, path)))
89-
.Concat(new[] { CurrentAssemblyDirectory }).Distinct();
92+
.Select(path => Path.Combine(baseDirectory, path));
9093
}
9194
}
9295
}

0 commit comments

Comments
 (0)