Skip to content

Commit

Permalink
Use AppContext.BaseDirectory as default for AssemblyInjectorOptions.M…
Browse files Browse the repository at this point in the history
…oduleDirectory.
  • Loading branch information
alexrp committed Dec 31, 2023
1 parent 6ed11d4 commit 817252f
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions src/injection/AssemblyInjectorOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,12 @@ public sealed class AssemblyInjectorOptions

public ImmutableArray<string> Arguments { get; private set; } = [];

public string ModuleDirectory { get; private set; } = _defaultDirectory;
public string ModuleDirectory { get; private set; } = AppContext.BaseDirectory;

public TimeSpan InjectionTimeout { get; private set; } = Timeout.InfiniteTimeSpan;

public TimeSpan CompletionTimeout { get; private set; } = Timeout.InfiniteTimeSpan;

private static readonly string _defaultDirectory;

[SuppressMessage("", "CA1810")]
[UnconditionalSuppressMessage("", "IL3000")]
static AssemblyInjectorOptions()
{
// TODO: https://github.com/dotnet/Nerdbank.GitVersioning/issues/555
#pragma warning disable CS0436
var location = typeof(ThisAssembly).Assembly.Location;
#pragma warning restore CS0436

_defaultDirectory = Path.GetDirectoryName(location.Length != 0 ? location : Environment.ProcessPath) ??
Environment.CurrentDirectory;
}

private AssemblyInjectorOptions()
{
}
Expand Down

0 comments on commit 817252f

Please sign in to comment.