Skip to content

Commit 813c14d

Browse files
committed
Merge with origin
2 parents d74e7ce + 58a3710 commit 813c14d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ pub fn open_dialog(filter_list: Option<&str>, default_path: Option<&str>, dialog
136136
let ptr_out_path = &mut out_path as *mut *mut c_char;
137137

138138
let mut out_multiple = nfdpathset_t::default();
139-
let ptr_out_multyple = &mut out_multiple as *mut nfdpathset_t;
139+
let ptr_out_multiple = &mut out_multiple as *mut nfdpathset_t;
140140

141141
unsafe {
142142
result = match dialog_type {
@@ -145,7 +145,7 @@ pub fn open_dialog(filter_list: Option<&str>, default_path: Option<&str>, dialog
145145
},
146146

147147
DialogType::MultipleFiles => {
148-
NFD_OpenDialogMultiple(filter_list_ptr, default_path_ptr, ptr_out_multyple)
148+
NFD_OpenDialogMultiple(filter_list_ptr, default_path_ptr, ptr_out_multiple)
149149
},
150150

151151
DialogType::SaveFile => {
@@ -159,10 +159,7 @@ pub fn open_dialog(filter_list: Option<&str>, default_path: Option<&str>, dialog
159159

160160
match result {
161161
nfdresult_t::NFD_OKAY =>{
162-
if dialog_type == DialogType::SingleFile ||
163-
dialog_type == DialogType::PickFolder {
164-
Ok(Response::Okay(CStr::from_ptr(out_path).to_string_lossy().into_owned()))
165-
} else {
162+
if dialog_type == DialogType::MultipleFiles {
166163
let count = NFD_PathSet_GetCount(&out_multiple);
167164
let mut res = Vec::with_capacity(count);
168165
for i in 0..count {
@@ -171,9 +168,11 @@ pub fn open_dialog(filter_list: Option<&str>, default_path: Option<&str>, dialog
171168

172169
}
173170

174-
NFD_PathSet_Free(ptr_out_multyple);
171+
NFD_PathSet_Free(ptr_out_multiple);
175172

176173
Ok(Response::OkayMultiple(res))
174+
} else {
175+
Ok(Response::Okay(CStr::from_ptr(out_path).to_string_lossy().into_owned()))
177176
}
178177
},
179178

0 commit comments

Comments
 (0)