resolveHubDataDir function

String? resolveHubDataDir(
  1. ArgResults args
)

The directory hub start persists the fleet in.

Note the deliberate asymmetry with resolveDataDir: an explicit --data-dir on hub start names the Hub's own directory — as it always has — and is used verbatim. Only the default is composed, as <root>/hub.

This is what lets service install and hub start agree without either one double-appending: service install resolves the root and bakes --data-dir <root>/hub into the command, and hub start then takes that path as given.

Returns null for --ephemeral.

Implementation

String? resolveHubDataDir(ArgResults args) {
  final raw = (args['data-dir'] as String?)?.trim();
  final explicit = raw != null && raw.isNotEmpty;

  if (args['ephemeral'] as bool) {
    if (explicit) {
      throw CliError(
        'use either --data-dir or --ephemeral, not both '
        '(--ephemeral means "persist nothing")',
      );
    }
    return null;
  }
  if (explicit) return p.normalize(p.absolute(raw));
  return hubDataDir(OmnyServerHome.resolve());
}