diff --git a/scripts/dev-reload.ps1 b/scripts/dev-reload.ps1 index 391b40f..7ab8ad3 100644 --- a/scripts/dev-reload.ps1 +++ b/scripts/dev-reload.ps1 @@ -196,7 +196,7 @@ function Start-AquariumProcess { "--shader-source", (Join-Path $SlotPath "Render\Shaders\D3D12HeightField.hlsl"), "--client-assembly", $LiveAssemblyPath, "--client-reload-pointer", $liveReloadPointerPath, - "--client-trusted-root", $slotRoot + "--client-trusted-root", $devRoot ) if ($RunHeadless) { $arguments += "--headless" diff --git a/tests/Aquarium.Engine.Tests/ClientRuntimeLoaderTrustTests.cs b/tests/Aquarium.Engine.Tests/ClientRuntimeLoaderTrustTests.cs index 0ef0a7b..afe9c03 100644 --- a/tests/Aquarium.Engine.Tests/ClientRuntimeLoaderTrustTests.cs +++ b/tests/Aquarium.Engine.Tests/ClientRuntimeLoaderTrustTests.cs @@ -38,6 +38,23 @@ public sealed class ClientRuntimeLoaderTrustTests : IDisposable Assert.NotNull(loader.Runtime); } + [Fact] + public void SiblingDirectoryOfTheInitialAssemblyLoadsOnlyInsideTheExplicitRoot() + { + // dev-watch reloads from live-slots, a sibling of the slot the host started in. + var slot = Directory.CreateDirectory(Path.Combine(trusted, "slots", "s1")).FullName; + var live = Directory.CreateDirectory(Path.Combine(trusted, "live-slots", "s2")).FullName; + var sibling = Copy(live); + using var loader = new ClientRuntimeLoader(Options, Copy(slot), trustedRoot: trusted); + loader.Load(); + loader.Reload(sibling, Options); + Assert.Throws(() => loader.Reload(Copy(outside), Options)); + + using var narrow = new ClientRuntimeLoader(Options, Path.Combine(slot, "client.dll")); + narrow.Load(); + Assert.Throws(() => narrow.Reload(sibling, Options)); // default root is the initial directory + } + [Fact] public void InitialAssemblyOutsideTheExplicitRootIsRefused() {