mirror of
https://gitlab.com/cleanflash/installer.git
synced 2026-08-12 18:31:37 +08:00
Fix Mac support (install to user)
This commit is contained in:
@@ -116,14 +116,21 @@ pub fn get_native_host_install_dir() -> PathBuf {
|
|||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
pub fn get_native_host_install_dir() -> PathBuf {
|
pub fn get_native_host_install_dir() -> PathBuf {
|
||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_os = "macos") {
|
||||||
PathBuf::from("/Library/Application Support/Clean Flash")
|
// Install to ~/Library/Application Support/Clean Flash instead
|
||||||
} else {
|
if let Ok(home) = std::env::var("HOME") {
|
||||||
|
PathBuf::from(home).join("Library/Application Support/Clean Flash")
|
||||||
|
} else {
|
||||||
|
PathBuf::from("/Library/Application Support/Clean Flash")
|
||||||
|
}
|
||||||
|
} else if cfg!(target_os = "linux") {
|
||||||
// Linux
|
// Linux
|
||||||
if let Ok(home) = std::env::var("HOME") {
|
if let Ok(home) = std::env::var("HOME") {
|
||||||
PathBuf::from(home).join(".cleanflash")
|
PathBuf::from(home).join(".cleanflash")
|
||||||
} else {
|
} else {
|
||||||
PathBuf::from("/tmp/.cleanflash")
|
PathBuf::from("/tmp/.cleanflash")
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
unreachable!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,6 +185,11 @@ fn get_non_windows_browser_targets(home: &Path) -> Vec<BrowserManifestTarget> {
|
|||||||
manifest_dir: home.join("Library/Application Support/Mozilla/NativeMessagingHosts"),
|
manifest_dir: home.join("Library/Application Support/Mozilla/NativeMessagingHosts"),
|
||||||
kind: BrowserKind::Firefox,
|
kind: BrowserKind::Firefox,
|
||||||
},
|
},
|
||||||
|
BrowserManifestTarget {
|
||||||
|
detect_path: home.join("Library/Application Support/net.imput.helium"),
|
||||||
|
manifest_dir: home.join("Library/Application Support/net.imput.helium/NativeMessagingHosts"),
|
||||||
|
kind: BrowserKind::ChromeLike,
|
||||||
|
}
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
vec![
|
vec![
|
||||||
@@ -211,11 +223,16 @@ fn get_non_windows_browser_targets(home: &Path) -> Vec<BrowserManifestTarget> {
|
|||||||
manifest_dir: home.join(".config/arc/NativeMessagingHosts"),
|
manifest_dir: home.join(".config/arc/NativeMessagingHosts"),
|
||||||
kind: BrowserKind::ChromeLike,
|
kind: BrowserKind::ChromeLike,
|
||||||
},
|
},
|
||||||
|
BrowserManifestTarget {
|
||||||
|
detect_path: home.join(".config/net.imput.helium"),
|
||||||
|
manifest_dir: home.join(".config/net.imput.helium/NativeMessagingHosts"),
|
||||||
|
kind: BrowserKind::ChromeLike,
|
||||||
|
},
|
||||||
BrowserManifestTarget {
|
BrowserManifestTarget {
|
||||||
detect_path: home.join(".mozilla"),
|
detect_path: home.join(".mozilla"),
|
||||||
manifest_dir: home.join(".mozilla/native-messaging-hosts"),
|
manifest_dir: home.join(".mozilla/native-messaging-hosts"),
|
||||||
kind: BrowserKind::Firefox,
|
kind: BrowserKind::Firefox,
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,10 @@ pub fn install(
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let archive_bytes: &[u8] = include_bytes!("../cleanflash.7z");
|
#[cfg(target_os = "linux")]
|
||||||
|
let archive_bytes: &[u8] = include_bytes!("../cleanflash-linux.7z");
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let archive_bytes: &[u8] = include_bytes!("../cleanflash-macos.7z");
|
||||||
|
|
||||||
if archive_bytes.is_empty() {
|
if archive_bytes.is_empty() {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ pub fn install(
|
|||||||
// The 7z archive is embedded in the binary via include_bytes!.
|
// The 7z archive is embedded in the binary via include_bytes!.
|
||||||
// For the port, we expect it at a known resource path; if not present,
|
// For the port, we expect it at a known resource path; if not present,
|
||||||
// this is a no-op placeholder.
|
// this is a no-op placeholder.
|
||||||
let archive_bytes: &[u8] = include_bytes!("../cleanflash.7z");
|
let archive_bytes: &[u8] = include_bytes!("../cleanflash-win.7z");
|
||||||
|
|
||||||
if archive_bytes.is_empty() {
|
if archive_bytes.is_empty() {
|
||||||
// Nothing to extract; still apply the rest of the steps.
|
// Nothing to extract; still apply the rest of the steps.
|
||||||
|
|||||||
Reference in New Issue
Block a user