mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-07-31 16:37:29 +02:00
chore: linting
This commit is contained in:
@@ -224,11 +224,11 @@ mod windows {
|
|||||||
.map_err(|e| format!("Failed to create URLAssociations key: {}", e))?;
|
.map_err(|e| format!("Failed to create URLAssociations key: {}", e))?;
|
||||||
|
|
||||||
url_assoc
|
url_assoc
|
||||||
.set_value("http", &PROG_ID)
|
.set_value("http", PROG_ID)
|
||||||
.map_err(|e| format!("Failed to set http association: {}", e))?;
|
.map_err(|e| format!("Failed to set http association: {}", e))?;
|
||||||
|
|
||||||
url_assoc
|
url_assoc
|
||||||
.set_value("https", &PROG_ID)
|
.set_value("https", PROG_ID)
|
||||||
.map_err(|e| format!("Failed to set https association: {}", e))?;
|
.map_err(|e| format!("Failed to set https association: {}", e))?;
|
||||||
|
|
||||||
// Set file associations
|
// Set file associations
|
||||||
@@ -237,11 +237,11 @@ mod windows {
|
|||||||
.map_err(|e| format!("Failed to create FileAssociations key: {}", e))?;
|
.map_err(|e| format!("Failed to create FileAssociations key: {}", e))?;
|
||||||
|
|
||||||
file_assoc
|
file_assoc
|
||||||
.set_value(".html", &PROG_ID)
|
.set_value(".html", PROG_ID)
|
||||||
.map_err(|e| format!("Failed to set .html association: {}", e))?;
|
.map_err(|e| format!("Failed to set .html association: {}", e))?;
|
||||||
|
|
||||||
file_assoc
|
file_assoc
|
||||||
.set_value(".htm", &PROG_ID)
|
.set_value(".htm", PROG_ID)
|
||||||
.map_err(|e| format!("Failed to set .htm association: {}", e))?;
|
.map_err(|e| format!("Failed to set .htm association: {}", e))?;
|
||||||
|
|
||||||
// Register the ProgID
|
// Register the ProgID
|
||||||
@@ -305,7 +305,7 @@ mod windows {
|
|||||||
match hkcu.create_subkey(&user_choice_path) {
|
match hkcu.create_subkey(&user_choice_path) {
|
||||||
Ok((user_choice, _)) => {
|
Ok((user_choice, _)) => {
|
||||||
// Attempt to set the ProgId
|
// Attempt to set the ProgId
|
||||||
if let Err(_) = user_choice.set_value("ProgId", &PROG_ID) {
|
if user_choice.set_value("ProgId", PROG_ID).is_err() {
|
||||||
// If we can't set UserChoice, that's expected on newer Windows versions
|
// If we can't set UserChoice, that's expected on newer Windows versions
|
||||||
// The registration is still valuable for the "Open with" menu
|
// The registration is still valuable for the "Open with" menu
|
||||||
}
|
}
|
||||||
@@ -328,7 +328,7 @@ mod windows {
|
|||||||
match hkcu.create_subkey(&ext_path) {
|
match hkcu.create_subkey(&ext_path) {
|
||||||
Ok((ext_key, _)) => {
|
Ok((ext_key, _)) => {
|
||||||
// Set the default value to our ProgID
|
// Set the default value to our ProgID
|
||||||
let _ = ext_key.set_value("", &PROG_ID);
|
let _ = ext_key.set_value("", PROG_ID);
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// Continue if we can't set the file association
|
// Continue if we can't set the file association
|
||||||
@@ -345,37 +345,29 @@ mod windows {
|
|||||||
unsafe {
|
unsafe {
|
||||||
use std::ffi::c_void;
|
use std::ffi::c_void;
|
||||||
|
|
||||||
// Declare the Windows API functions
|
|
||||||
type UINT = u32;
|
|
||||||
type DWORD = u32;
|
|
||||||
type LPARAM = isize;
|
|
||||||
type WPARAM = usize;
|
|
||||||
|
|
||||||
const HWND_BROADCAST: *mut c_void = 0xffff as *mut c_void;
|
const HWND_BROADCAST: *mut c_void = 0xffff as *mut c_void;
|
||||||
const WM_SETTINGCHANGE: UINT = 0x001A;
|
const WM_SETTINGCHANGE: u32 = 0x001A;
|
||||||
const SMTO_ABORTIFHUNG: UINT = 0x0002;
|
const SMTO_ABORTIFHUNG: u32 = 0x0002;
|
||||||
|
|
||||||
// Link to user32.dll functions
|
|
||||||
extern "system" {
|
extern "system" {
|
||||||
fn SendMessageTimeoutA(
|
fn SendMessageTimeoutA(
|
||||||
hWnd: *mut c_void,
|
hWnd: *mut c_void,
|
||||||
Msg: UINT,
|
Msg: u32,
|
||||||
wParam: WPARAM,
|
wParam: usize,
|
||||||
lParam: LPARAM,
|
lParam: isize,
|
||||||
fuFlags: UINT,
|
fuFlags: u32,
|
||||||
uTimeout: UINT,
|
uTimeout: u32,
|
||||||
lpdwResult: *mut DWORD,
|
lpdwResult: *mut u32,
|
||||||
) -> isize;
|
) -> isize;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut result: DWORD = 0;
|
let mut result: u32 = 0;
|
||||||
|
|
||||||
// Notify about file associations change
|
|
||||||
SendMessageTimeoutA(
|
SendMessageTimeoutA(
|
||||||
HWND_BROADCAST,
|
HWND_BROADCAST,
|
||||||
WM_SETTINGCHANGE,
|
WM_SETTINGCHANGE,
|
||||||
0,
|
0,
|
||||||
"Software\\Classes\0".as_ptr() as LPARAM,
|
c"Software\\Classes".as_ptr() as isize,
|
||||||
SMTO_ABORTIFHUNG,
|
SMTO_ABORTIFHUNG,
|
||||||
1000,
|
1000,
|
||||||
&mut result,
|
&mut result,
|
||||||
|
|||||||
@@ -895,6 +895,7 @@ impl Extractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
#[allow(clippy::type_complexity)]
|
||||||
fn find_windows_executable_recursive<'a>(
|
fn find_windows_executable_recursive<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
dir: &'a Path,
|
dir: &'a Path,
|
||||||
|
|||||||
Reference in New Issue
Block a user