tomSecretsBrowserHostBeside function

String tomSecretsBrowserHostBeside(
  1. String serviceExecutable, {
  2. required String operatingSystem,
})

The browser host tsm-browser-host beside the service whose executable is serviceExecutable (where the service recognises it, protocol.md 5.5, and where the distribution carries it).

Implementation

String tomSecretsBrowserHostBeside(
  String serviceExecutable, {
  required String operatingSystem,
}) {
  final windows = operatingSystem == 'windows';
  final sep = windows ? r'\' : '/';
  final cut = serviceExecutable.lastIndexOf(sep);
  final dir = cut < 0 ? '.' : serviceExecutable.substring(0, cut);
  return '$dir$sep$_browserHostName${windows ? '.exe' : ''}';
}