[Emulator] Added possiblity to install multiple packages at once
This commit is contained in:
@@ -114,7 +114,7 @@ bool Win32FilePicker::Show(Window* parent_window) {
|
||||
// TODO(benvanik): FileSaveDialog.
|
||||
assert_true(mode() == Mode::kOpen);
|
||||
|
||||
Microsoft::WRL::ComPtr<IFileDialog> file_dialog;
|
||||
Microsoft::WRL::ComPtr<IFileOpenDialog> file_dialog;
|
||||
HRESULT hr =
|
||||
CoCreateInstance(CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
|
||||
IID_PPV_ARGS(&file_dialog));
|
||||
@@ -192,23 +192,30 @@ bool Win32FilePicker::Show(Window* parent_window) {
|
||||
|
||||
// Obtain the result once the user clicks the 'Open' button.
|
||||
// The result is an IShellItem object.
|
||||
Microsoft::WRL::ComPtr<IShellItem> shell_item;
|
||||
hr = file_dialog->GetResult(&shell_item);
|
||||
Microsoft::WRL::ComPtr<IShellItemArray> shell_items;
|
||||
hr = file_dialog->GetResults(&shell_items);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We are just going to print out the name of the file for sample sake.
|
||||
PWSTR file_path = nullptr;
|
||||
hr = shell_item->GetDisplayName(SIGDN_FILESYSPATH, &file_path);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
return false;
|
||||
}
|
||||
std::vector<std::filesystem::path> selected_files;
|
||||
selected_files.push_back(std::filesystem::path(file_path));
|
||||
set_selected_files(selected_files);
|
||||
CoTaskMemFree(file_path);
|
||||
|
||||
DWORD items_count = 0;
|
||||
shell_items->GetCount(&items_count);
|
||||
// Iterate over selected files
|
||||
for (DWORD i = 0; i < items_count; i++) {
|
||||
Microsoft::WRL::ComPtr<IShellItem> shell_item;
|
||||
shell_items->GetItemAt(i, &shell_item);
|
||||
// We are just going to print out the name of the file for sample sake.
|
||||
PWSTR file_path = nullptr;
|
||||
hr = shell_item->GetDisplayName(SIGDN_FILESYSPATH, &file_path);
|
||||
if (!SUCCEEDED(hr)) {
|
||||
return false;
|
||||
}
|
||||
selected_files.push_back(std::filesystem::path(file_path));
|
||||
CoTaskMemFree(file_path);
|
||||
}
|
||||
set_selected_files(selected_files);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user