mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-07 02:57:34 +00:00
windows: Support dropping targets with filenames longer than 260 characters (#9115)
use `Vec` instead of slice to support dynamic filename length. Release Notes: - N/A
This commit is contained in:
parent
fb83cf2042
commit
9a2dceeea1
1 changed files with 3 additions and 3 deletions
|
@ -22,7 +22,7 @@ use smallvec::SmallVec;
|
|||
use windows::{
|
||||
core::{implement, w, HSTRING, PCWSTR},
|
||||
Win32::{
|
||||
Foundation::{FALSE, HINSTANCE, HWND, LPARAM, LRESULT, MAX_PATH, POINTL, S_OK, WPARAM},
|
||||
Foundation::{FALSE, HINSTANCE, HWND, LPARAM, LRESULT, POINTL, S_OK, WPARAM},
|
||||
Graphics::Gdi::{BeginPaint, EndPaint, InvalidateRect, PAINTSTRUCT},
|
||||
System::{
|
||||
Com::{IDataObject, DVASPECT_CONTENT, FORMATETC, TYMED_HGLOBAL},
|
||||
|
@ -983,9 +983,9 @@ impl IDropTarget_Impl for WindowsDragDropHandler {
|
|||
let hdrop = idata.u.hGlobal.0 as *mut HDROP;
|
||||
let file_count = DragQueryFileW(*hdrop, DRAGDROP_GET_FILES_COUNT, None);
|
||||
for file_index in 0..file_count {
|
||||
let mut buffer = [0u16; MAX_PATH as _];
|
||||
let filename_length = DragQueryFileW(*hdrop, file_index, None) as usize;
|
||||
let ret = DragQueryFileW(*hdrop, file_index, Some(&mut buffer));
|
||||
let mut buffer = vec![0u16; filename_length + 1];
|
||||
let ret = DragQueryFileW(*hdrop, file_index, Some(buffer.as_mut_slice()));
|
||||
if ret == 0 {
|
||||
log::error!("unable to read file name");
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue