This commit is contained in:
Robin Appelman 2025-10-12 14:45:18 +02:00
commit 55fb8a945c
2 changed files with 13 additions and 17 deletions

View file

@ -38,13 +38,11 @@ fn unix_home_dir() -> PathBuf {
fn chrome_user_manifest() -> PathBuf { fn chrome_user_manifest() -> PathBuf {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
unix_home_dir() unix_home_dir().join("Library/Application Support/Google/Chrome/NativeMessagingHosts")
.join("Library/Application Support/Google/Chrome/NativeMessagingHosts")
} }
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
unix_home_dir() unix_home_dir().join(".config/google-chrome/NativeMessagingHosts")
.join(".config/google-chrome/NativeMessagingHosts")
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {
@ -58,13 +56,11 @@ fn chrome_user_manifest() -> PathBuf {
fn firefox_user_manifest() -> PathBuf { fn firefox_user_manifest() -> PathBuf {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
unix_home_dir() unix_home_dir().join("Library/Application Support/Mozilla/NativeMessagingHosts")
.join("Library/Application Support/Mozilla/NativeMessagingHosts")
} }
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
{ {
unix_home_dir() unix_home_dir().join(".mozilla/native-messaging-hosts")
.join(".mozilla/native-messaging-hosts")
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {

View file

@ -1,13 +1,13 @@
mod install; mod install;
use crate::install::Browser;
use main_error::MainResult; use main_error::MainResult;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::env::{args, current_exe}; use std::env::{args, current_exe};
use std::fs::{create_dir_all, write}; use std::fs::{create_dir_all, write};
use std::io::{Error as IoError, ErrorKind, IsTerminal, Read, Write, stdin, stdout}; use std::io::{stdin, stdout, Error as IoError, ErrorKind, IsTerminal, Read, Write};
use std::str::FromStr; use std::str::FromStr;
use crate::install::Browser;
fn main() -> MainResult { fn main() -> MainResult {
let mut args = args(); let mut args = args();
@ -25,13 +25,12 @@ fn main() -> MainResult {
let browser = Browser::from_str(&args.next().unwrap_or_default())?; let browser = Browser::from_str(&args.next().unwrap_or_default())?;
let manifest_dir = browser.manifest_path(); let manifest_dir = browser.manifest_path();
create_dir_all(&manifest_dir)?; create_dir_all(&manifest_dir)?;
write( write(manifest_dir.join("originfox.json"), generate_manifest()?)?;
manifest_dir.join("originfox.json"),
generate_manifest()?,
)?;
println!("Manifest installed"); println!("Manifest installed");
println!(); println!();
println!("Note that the installed manifest includes the absolute path to this binary."); println!(
"Note that the installed manifest includes the absolute path to this binary."
);
println!("If you move this binary you'll need to re-install the manifest."); println!("If you move this binary you'll need to re-install the manifest.");
return Ok(()); return Ok(());
} }
@ -149,5 +148,6 @@ fn generate_manifest() -> Result<String, IoError> {
path, path,
ty: "stdio", ty: "stdio",
allowed_extensions: &["originfox@icewind.nl"], allowed_extensions: &["originfox@icewind.nl"],
}).unwrap()) })
.unwrap())
} }