402 {
403 ImGui::SetNextWindowSize(ImVec2(640, 480), ImGuiCond_Appearing);
404 ImGui::SetNextWindowSizeConstraints(ImVec2(400, 300), ImVec2(FLT_MAX, FLT_MAX));
405 if (ImGui::BeginPopupModal("DeleteAssets", nullptr))
406 {
407 static int tab = 0;
408 ImGui::RadioButton("Markers", &tab, 0);
409 ImGui::SameLine();
410 ImGui::RadioButton("Maps", &tab, 1);
411 auto kind = (tab == 0) ? AssetKind::Marker :
AssetKind::
Map;
412
414 ImGui::Separator();
415 ImGui::BeginChild("assets_scroll", ImVec2(500, 300), true);
416 bool deletedThisFrame = false;
417 for (auto& p : assets)
418 {
419 auto fname = p.filename().string();
420 ImGui::TextUnformatted(fname.c_str());
421 ImGui::SameLine();
422 ImGui::PushID(fname.c_str());
423 if (ImGui::SmallButton(("Delete##" + fname).c_str()))
424 {
425 std::string err;
427 {
428 std::cerr << "Delete failed: " << err << "\n";
429 if (auto t = toaster_.lock(); t)
431 }
432 else
433 {
434 deletedThisFrame = true;
435 if (auto t = toaster_.lock(); t)
437 }
438 }
439 ImGui::PopID();
440 if (deletedThisFrame)
441 break;
442 }
443 ImGui::EndChild();
444 ImGui::Separator();
445 if (ImGui::Button("Close"))
446 ImGui::CloseCurrentPopup();
447 ImGui::EndPopup();
448 }
449 }
bool deleteAsset(AssetKind kind, const std::filesystem::path &file, std::string *outError=nullptr)
std::vector< std::filesystem::path > listAssets(AssetKind kind)