// 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 SchedulerOsx extends SchedulerManager {
  SchedulerOsx({
    super.runtime,
    super.processFinder,
    super.exitHandler,
  });

  @override
  String get exePath {
    var exe = Platform.resolvedExecutable;
    // Handle homebrew-installed executable path
    if (exe.startsWith('/usr/local')) {
      //intel mac
      exe = '/usr/local/bin/${path.basenameWithoutExtension(exe)}';
    } else if (exe.startsWith('/opt/homebrew')) {
      //sillicon mac
      exe = '/opt/homebrew/bin/${path.basenameWithoutExtension(exe)}';
    }
    return exe;
  }
}
