@@ -25,6 +25,7 @@ use std::io::{
25
25
Write as _,
26
26
stdout,
27
27
} ;
28
+ use std:: path:: PathBuf ;
28
29
use std:: process:: ExitCode ;
29
30
30
31
use anstream:: {
@@ -57,7 +58,6 @@ use fig_proto::local::UiElement;
57
58
use fig_settings:: sqlite:: database;
58
59
use fig_util:: directories:: home_local_bin;
59
60
use fig_util:: {
60
- CHAT_BINARY_NAME ,
61
61
CLI_BINARY_NAME ,
62
62
PRODUCT_NAME ,
63
63
directories,
@@ -376,7 +376,7 @@ impl Cli {
376
376
}
377
377
}
378
378
379
- let mut cmd = tokio:: process:: Command :: new ( home_local_bin ( ) ?. join ( CHAT_BINARY_NAME ) ) ;
379
+ let mut cmd = tokio:: process:: Command :: new ( qchat_path ( ) ?) ;
380
380
cmd. arg ( subcmd) ;
381
381
if let Some ( args) = args {
382
382
cmd. args ( args) ;
@@ -534,6 +534,26 @@ async fn launch_dashboard(help_fallback: bool) -> Result<ExitCode> {
534
534
Ok ( ExitCode :: SUCCESS )
535
535
}
536
536
537
+ #[ cfg( target_os = "linux" ) ]
538
+ fn qchat_path ( ) -> Result < PathBuf > {
539
+ use fig_os_shim:: Context ;
540
+ use fig_util:: consts:: CHAT_BINARY_NAME ;
541
+
542
+ let ctx = Context :: new ( ) ;
543
+ if let Some ( path) = ctx. process_info ( ) . current_pid ( ) . exe ( ) {
544
+ // This is required for deb installations.
545
+ if path. starts_with ( "/usr/bin" ) {
546
+ return Ok ( PathBuf :: from ( "/usr/bin" ) . join ( CHAT_BINARY_NAME ) ) ;
547
+ }
548
+ }
549
+ Ok ( home_local_bin ( ) ?. join ( CHAT_BINARY_NAME ) )
550
+ }
551
+
552
+ #[ cfg( not( target_os = "linux" ) ) ]
553
+ fn qchat_path ( ) -> Result < PathBuf > {
554
+ Ok ( home_local_bin ( ) ?. join ( fig_util:: consts:: CHAT_BINARY_NAME ) )
555
+ }
556
+
537
557
#[ cfg( test) ]
538
558
mod test {
539
559
use super :: * ;
0 commit comments