Editor/Output/ArchHostSettled.cs
namespace Sunless.Architecture;
// The host's answers, asked once instead of per catalogue read - ArchHost.Load() runs a discovery scan, and folder
// resolution sits on the paint path. Held only until the assembly changes, the way ArchStorage holds its serialiser.
public static class ArchHostSettled {
static ArchHost held;
static string heldFor;
// A stock answer is never remembered: discovery can come up empty before the game's assembly has enrolled, and
// caching that would strand every catalogue in the library's own folders until the next reload.
public static ArchHost Now {
get {
var assembly = typeof( ArchHostSettled ).Assembly.FullName;
if ( heldFor != assembly ) {
heldFor = assembly;
held = null;
}
if ( held is not null ) {
return held;
}
var asked = ArchHost.Load();
return asked.IsStock ? asked : held = asked;
}
}
}