install method

Future<void> install(
  1. TomSecretsBrowser b
)

Writes the manifest for b (and on Windows its registry value). Throws StateError for a sandboxed browser.

Implementation

Future<void> install(TomSecretsBrowser b) async {
  final sandboxed = (await state(b)).sandboxed;
  if (sandboxed != null) throw StateError(sandboxed);
  final file = File(manifestPath(b));
  file.parent.createSync(recursive: true);
  file.writeAsStringSync(
    '${const JsonEncoder.withIndent('  ').convert(manifest(b))}\n',
  );
  final key = registryKey(b);
  if (key != null) await _registry.write(key, file.path);
}