Update lib.rs

pull/125/head
Mohamad 2 years ago
parent e151ffcf61
commit 68cb1a4b48
No known key found for this signature in database
GPG Key ID: A1F7472F479B40A0

@ -3,6 +3,7 @@
// SPDX-License-Identifier: MIT
use auto_launch::{AutoLaunch, AutoLaunchBuilder};
use log::info;
use serde::{ser::Serializer, Serialize};
use tauri::{
command,
@ -98,7 +99,6 @@ pub fn init<R: Runtime>(
.invoke_handler(tauri::generate_handler![enable, disable, is_enabled])
.setup(move |app| {
let mut builder = AutoLaunchBuilder::new();
builder.set_app_name(&app.package_info().name);
if let Some(args) = args {
builder.set_args(&args);
@ -110,7 +110,17 @@ pub fn init<R: Runtime>(
#[cfg(windows)]
builder.set_app_path(&current_exe.display().to_string());
#[cfg(target_os = "macos")]
builder.set_app_path(&current_exe.canonicalize()?.display().to_string());
{
let exe_path = current_exe.canonicalize()?.display().to_string();
let parts: Vec<&str> = exe_path.split(".app/").collect();
let app_path = format!(
"{}{}",
parts.get(0).expect("to be an app").to_string(),
".app"
);
info!("auto_start path {}", &app_path);
builder.set_app_path(&app_path);
}
#[cfg(target_os = "linux")]
if let Some(appimage) = app
.env()

Loading…
Cancel
Save