From 324069473f22bf9c16aeba7e23e2c585a140720c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Proch=C3=A1zka?= Date: Sun, 12 Jan 2025 15:28:21 +0100 Subject: [PATCH] remove open_file --- gui/src/ui/windows/dialogs.rs | 44 +---------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/gui/src/ui/windows/dialogs.rs b/gui/src/ui/windows/dialogs.rs index f9a0ee927..976ad8fb0 100644 --- a/gui/src/ui/windows/dialogs.rs +++ b/gui/src/ui/windows/dialogs.rs @@ -40,49 +40,7 @@ pub async fn open_file( title: impl AsRef, ty: FileType, ) -> Option { - let hwnd = get_hwnd(parent); - - let title_wide: Vec = title - .as_ref() - .encode_utf16() - .chain(std::iter::once(0)) - .collect(); - - spawn_dialog(move || unsafe { - let mut ofn: OPENFILENAMEW = std::mem::zeroed(); - ofn.lStructSize = std::mem::size_of::() as u32; - ofn.hwndOwner = hwnd.get() as _; - - ofn.lpstrTitle = title_wide.as_ptr(); - - const MAX_PATH: usize = 260; - let mut file_buffer = [0u16; MAX_PATH]; - ofn.lpstrFile = file_buffer.as_mut_ptr(); - ofn.nMaxFile = file_buffer.len() as u32; - - // Filter - match ty { - FileType::Firmware => { - let filter_str = "Firmware Dump\0*.obf\0\0" - .encode_utf16() - .collect::>(); - ofn.lpstrFilter = filter_str.as_ptr(); - } - } - - let ret = GetOpenFileNameW(&mut ofn); - if ret != 0 { - let len = file_buffer - .iter() - .position(|&c| c == 0) - .unwrap_or(file_buffer.len()); - let path = String::from_utf16_lossy(&file_buffer[..len]); - Some(PathBuf::from(path)) - } else { - None - } - }) - .await + todo!() } pub async fn open_dir(parent: &T, title: impl AsRef) -> Option {