Skip to content

Commit

Permalink
Add SHCNF_FLUSH for better Win11 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Dec 5, 2023
1 parent 8887f91 commit 0df7d75
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blackhole"
version = "4.1.0"
version = "4.1.1"
authors = ["William Venner <william@venner.io>"]
edition = "2018"
repository = "https://github.com/WilliamVenner/blackhole"
Expand Down
3 changes: 2 additions & 1 deletion src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern "system" {
}
const SHCNE_UPDATEDIR: winapi::um::winnt::LONG = 0x00001000;
const SHCNF_PATHW: winapi::shared::minwindef::UINT = 0x0005;
const SHCNF_FLUSH: winapi::shared::minwindef::UINT = 4096u32;

pub trait Windows {
fn powershell(script: String);
Expand Down Expand Up @@ -63,7 +64,7 @@ impl Windows for Blackhole {

// SHChangeNotify(SHCNE_UPDATEDIR, ...) tell a file or directory to update its icon
fn change_notify(ptr: *const winapi::ctypes::c_void) {
unsafe { SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATHW, ptr, std::ptr::null_mut()); }
unsafe { SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATHW | SHCNF_FLUSH, ptr, std::ptr::null_mut()); }
}

// Sets Windows file attributes
Expand Down

0 comments on commit 0df7d75

Please sign in to comment.