From 3daf42c97071ed56bc7aa46c065b6cfe067818b8 Mon Sep 17 00:00:00 2001 From: Toki Date: Wed, 1 Jan 2025 10:43:29 +0900 Subject: [PATCH] update exe path --- bin/main.dart | 7 ++----- lib/cli/commands/scheduler/scheduler_linux.dart | 13 ++++++++++++- lib/cli/commands/scheduler/scheduler_osx.dart | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bin/main.dart b/bin/main.dart index 5c10e48..26a5f24 100644 --- a/bin/main.dart +++ b/bin/main.dart @@ -9,9 +9,6 @@ import 'package:oto_cli/cli/commands/command_exe.dart'; void main(List arguments) async { await initialize('oto', 'com.toki-labs.oto'); - CLI.initialize('oto', arguments, [ - CommandTemplate(), - CommandExe(), - CommandScheduler() - ]); + CLI.initialize( + 'oto', arguments, [CommandTemplate(), CommandExe(), CommandScheduler()]); } diff --git a/lib/cli/commands/scheduler/scheduler_linux.dart b/lib/cli/commands/scheduler/scheduler_linux.dart index eb970b1..d6acbb7 100644 --- a/lib/cli/commands/scheduler/scheduler_linux.dart +++ b/lib/cli/commands/scheduler/scheduler_linux.dart @@ -1,10 +1,21 @@ +// ignore_for_file: depend_on_referenced_packages + import 'dart:io'; import 'package:oto_cli/cli/commands/scheduler/scheduler_manager.dart'; +import 'package:path/path.dart' as path; class SchedulerLinux extends SchedulerManager { @override String get exePath { - return Platform.resolvedExecutable; + //home/linuxbrew/.linuxbrew/Cellar/oto/0.0.273/bin/oto + var exe = Platform.resolvedExecutable; + if (exe.contains('.linuxbrew')) { + var rootPath = 'home/linuxbrew/.linuxbrew/Cellar/oto/0.0.273/bin/oto'; + var index = rootPath.indexOf('.linuxbrew'); + rootPath = rootPath.substring(0, index); + exe = '$rootPath.linuxbrew/bin/${path.basenameWithoutExtension(exe)}'; + } + return exe; } } diff --git a/lib/cli/commands/scheduler/scheduler_osx.dart b/lib/cli/commands/scheduler/scheduler_osx.dart index 9dfa1ac..f3e16e6 100644 --- a/lib/cli/commands/scheduler/scheduler_osx.dart +++ b/lib/cli/commands/scheduler/scheduler_osx.dart @@ -1,3 +1,5 @@ +// ignore_for_file: depend_on_referenced_packages + import 'dart:io'; import 'package:oto_cli/cli/commands/scheduler/scheduler_manager.dart';