mirror of
https://github.com/Smaug123/WoofWare.Whippet
synced 2025-10-05 07:48:40 +00:00
Some checks are pending
.NET / build (Debug) (push) Waiting to run
.NET / build (Release) (push) Waiting to run
.NET / analyzers (push) Waiting to run
.NET / check-dotnet-format (push) Waiting to run
.NET / check-nix-format (push) Waiting to run
.NET / Check links (push) Waiting to run
.NET / Check flake (push) Waiting to run
.NET / nuget-pack (push) Waiting to run
.NET / expected-pack (push) Blocked by required conditions
.NET / check-accurate-generations (push) Waiting to run
.NET / all-required-checks-complete (push) Blocked by required conditions
.NET / nuget-publish (push) Blocked by required conditions
.NET / nuget-publish-fantomas (push) Blocked by required conditions
.NET / nuget-publish-json-plugin (push) Blocked by required conditions
.NET / nuget-publish-json-attrs (push) Blocked by required conditions
.NET / nuget-publish-argparser-plugin (push) Blocked by required conditions
.NET / nuget-publish-argparser-attrs (push) Blocked by required conditions
34 lines
1.1 KiB
Forth
34 lines
1.1 KiB
Forth
namespace WoofWare.Whippet
|
|
|
|
open System
|
|
open System.IO
|
|
open System.Reflection
|
|
|
|
// Fix for https://github.com/Smaug123/unofficial-nunit-runner/issues/8
|
|
// (This tells the DLL loader to look next to the input DLL for dependencies.)
|
|
/// Context manager to set the AppContext.BaseDirectory of the executing DLL.
|
|
type SetBaseDir (testDll : FileInfo) =
|
|
let oldBaseDir = AppContext.BaseDirectory
|
|
|
|
let setData =
|
|
let appContext = Type.GetType "System.AppContext"
|
|
|
|
if Object.ReferenceEquals (appContext, (null : obj)) then
|
|
ignore<string * string>
|
|
else
|
|
|
|
let setDataMethod =
|
|
appContext.GetMethod ("SetData", BindingFlags.Static ||| BindingFlags.Public)
|
|
|
|
if Object.ReferenceEquals (setDataMethod, (null : obj)) then
|
|
ignore<string * string>
|
|
else
|
|
|
|
fun (k, v) -> setDataMethod.Invoke ((null : obj), [| k ; v |]) |> unbox<unit>
|
|
|
|
do setData ("APP_CONTEXT_BASE_DIRECTORY", testDll.Directory.FullName)
|
|
|
|
interface IDisposable with
|
|
member _.Dispose () =
|
|
setData ("APP_CONTEXT_BASE_DIRECTORY", oldBaseDir)
|