// ignore_for_file: depend_on_referenced_packages

import 'dart:io';

import 'package:oto/cli/commands/scheduler/scheduler_manager.dart';
import 'package:path/path.dart' as path;

class SchedulerLinux extends SchedulerManager {
  SchedulerLinux({
    super.runtime,
    super.processFinder,
    super.exitHandler,
  });

  @override
  String get exePath {
    // /home/linuxbrew/.linuxbrew/Cellar/oto/0.0.273/bin/oto
    var exe = Platform.resolvedExecutable;
    final key = '.linuxbrew';
    if (exe.contains(key)) {
      var index = exe.indexOf('.linuxbrew');
      var rootPath = exe.substring(0, index);
      exe = '$rootPath.linuxbrew/bin/${path.basenameWithoutExtension(exe)}';
    }
    return exe;
  }
}
