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

View file

@ -1,13 +1,13 @@
mod install;
use crate::install::Browser;
use main_error::MainResult;
use owo_colors::OwoColorize;
use serde::{Deserialize, Serialize};
use std::env::{args, current_exe};
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 crate::install::Browser;
fn main() -> MainResult {
let mut args = args();
@ -25,13 +25,12 @@ fn main() -> MainResult {
let browser = Browser::from_str(&args.next().unwrap_or_default())?;
let manifest_dir = browser.manifest_path();
create_dir_all(&manifest_dir)?;
write(
manifest_dir.join("originfox.json"),
generate_manifest()?,
)?;
write(manifest_dir.join("originfox.json"), generate_manifest()?)?;
println!("Manifest installed");
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.");
return Ok(());
}
@ -149,5 +148,6 @@ fn generate_manifest() -> Result<String, IoError> {
path,
ty: "stdio",
allowed_extensions: &["originfox@icewind.nl"],
}).unwrap())
})
.unwrap())
}