| 435 | } |
| 436 | |
| 437 | void View::onEjectPressed() { |
| 438 | std::string mount_path = state->getSelectedChildPath(); |
| 439 | LOGGER.info("Ejecting {}", mount_path); |
| 440 | |
| 441 | struct Device* msc_dev = device_find_first_active_by_type(&USB_HOST_MSC_TYPE); |
| 442 | if (!msc_dev || !usb_msc_eject(msc_dev, mount_path.c_str())) { |
| 443 | LOGGER.warn("usb_msc_eject: {} not found", mount_path); |
| 444 | alertdialog::start("Eject failed", "Could not eject \"" + file::getLastPathSegment(mount_path) + "\"."); |
| 445 | } |
| 446 | |
| 447 | onNavigate(); |
| 448 | state->setEntriesForPath(state->getCurrentPath()); |
| 449 | update(); |
| 450 | } |
| 451 | |
| 452 | void View::update(size_t start_index) { |
| 453 | const bool is_root = (state->getCurrentPath() == "/"); |
no test coverage detected