File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,7 @@ struct FirefoxHostManifest<'a> {
3737}
3838
3939fn 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
Original file line number Diff line number Diff line change 1- #![ cfg( windows) ]
2- #![ cfg_attr( not( windows) , allow( dead_code) ) ]
3-
41use crate :: install:: paths:: chrome_user_manifest;
52use std:: { io, path:: PathBuf } ;
63use 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`.
87pub 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.
1717pub 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}" ) ;
You can’t perform that action at this time.
0 commit comments