A bad package station kind excludes the package; AetherDb opens a catalog with a kindless station hull, names it, and station-kinds hull sets it; the raw opener is gone
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
37a8110907
commit
d2f4b2c347
5 changed files with 59 additions and 19 deletions
|
|
@ -3,25 +3,27 @@ using System.IO;
|
|||
using GameCult.Caching;
|
||||
|
||||
// Opens GameData/Aetheria.cc through AetheriaStores, the game's own store composition. The catalog attaches read-only
|
||||
// unless a command writes it, so a command that only reads cannot write.
|
||||
// unless a command writes it, so a command that only reads cannot write. A station hull with no kind does not lock the
|
||||
// catalog: it is named to warn (stderr by default) and the commands that repair it stay reachable.
|
||||
public sealed class AetherDb
|
||||
{
|
||||
public string Root { get; }
|
||||
public CultCache Cache { get; }
|
||||
|
||||
private AetherDb(string root, bool catalogWritable, bool withRun)
|
||||
private AetherDb(string root, bool catalogWritable, bool withRun, Action<string> warn)
|
||||
{
|
||||
Root = root;
|
||||
var gameData = Path.Combine(root, "GameData");
|
||||
Cache = AetheriaStores.Open(
|
||||
Path.Combine(gameData, "Aetheria.cc"),
|
||||
runPath: withRun ? Path.Combine(gameData, "run.cc") : null,
|
||||
catalogWritable: catalogWritable);
|
||||
catalogWritable: catalogWritable,
|
||||
kindlessStation: warn ?? Console.Error.WriteLine);
|
||||
}
|
||||
|
||||
// With no root given, walks up from the working directory to the game folder: the first folder whose GameData holds Aetheria.cc
|
||||
public static AetherDb Open(bool catalogWritable = false, bool withRun = false, string root = null) =>
|
||||
new AetherDb(root ?? FindRoot(), catalogWritable, withRun);
|
||||
public static AetherDb Open(bool catalogWritable = false, bool withRun = false, string root = null, Action<string> warn = null) =>
|
||||
new AetherDb(root ?? FindRoot(), catalogWritable, withRun, warn);
|
||||
|
||||
public static string FindRoot()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue