| 63 | } |
| 64 | |
| 65 | std::unique_ptr<Txt> ReaderActivity::loadTxt(const std::string& path) { |
| 66 | if (!Storage.exists(path.c_str())) { |
| 67 | LOG_ERR("READER", "File does not exist: %s", path.c_str()); |
| 68 | return nullptr; |
| 69 | } |
| 70 | |
| 71 | auto txt = makeUniqueNoThrow<Txt>(path, "/.crosspoint"); |
| 72 | if (!txt) { |
| 73 | LOG_ERR("READER", "Failed to allocate TXT object"); |
| 74 | return nullptr; |
| 75 | } |
| 76 | if (txt->load()) { |
| 77 | return txt; |
| 78 | } |
| 79 | |
| 80 | LOG_ERR("READER", "Failed to load TXT"); |
| 81 | return nullptr; |
| 82 | } |
| 83 | |
| 84 | void ReaderActivity::goToLibrary(const std::string& fromBookPath) { |
| 85 | // If coming from a book, start in that book's folder; otherwise start from root |