Skip to content

Commit 544f3ff

Browse files
committed
Fixed warnings addded
1 parent 02512d7 commit 544f3ff

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/install/manifest.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ struct FirefoxHostManifest<'a> {
3737
}
3838

3939
fn ensure_absolute_path(exe_path: &Path) -> io::Result<()> {
40-
// Chrome spec: path must be absolute on macOS/Linux. Firefox follows same convention.
41-
// Windows allows relative, but absolute is safest cross-platform. :contentReference[oaicite:3]{index=3}
40+
// On macOS/Linux the manifest "path" MUST be absolute.
4241
#[cfg(any(target_os = "macos", target_os = "linux"))]
4342
{
4443
if !exe_path.is_absolute() {
@@ -48,6 +47,14 @@ fn ensure_absolute_path(exe_path: &Path) -> io::Result<()> {
4847
));
4948
}
5049
}
50+
51+
// On Windows we accept any (absolute recommended). Touch exe_path
52+
// to avoid an unused-variable warning in Windows builds.
53+
#[cfg(windows)]
54+
{
55+
let _ = exe_path;
56+
}
57+
5158
Ok(())
5259
}
5360

src/install/winreg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#![cfg(windows)]
2-
#![cfg_attr(not(windows), allow(dead_code))]
3-
41
use crate::install::paths::chrome_user_manifest;
52
use std::{io, path::PathBuf};
63
use winreg::{enums::HKEY_CURRENT_USER, RegKey};
74

5+
/// Write the Chrome native-messaging registry value under HKCU so Chrome
6+
/// can find the manifest file at the given host `name`.
87
pub fn write_chrome_manifest_reg(name: &str) -> io::Result<()> {
98
let hkcu = RegKey::predef(HKEY_CURRENT_USER);
109
let key_path = format!(r"Software\Google\Chrome\NativeMessagingHosts\{name}");
@@ -14,6 +13,7 @@ pub fn write_chrome_manifest_reg(name: &str) -> io::Result<()> {
1413
Ok(())
1514
}
1615

16+
/// Remove the HKCU registry value for the Chrome native-messaging host.
1717
pub fn remove_chrome_manifest_reg(name: &str) -> io::Result<()> {
1818
let hkcu = RegKey::predef(HKEY_CURRENT_USER);
1919
let key_path = format!(r"Software\Google\Chrome\NativeMessagingHosts\{name}");

0 commit comments

Comments
 (0)