MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / loadTxt

Method loadTxt

src/activities/reader/ReaderActivity.cpp:65–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65std::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
84void ReaderActivity::goToLibrary(const std::string& fromBookPath) {
85 // If coming from a book, start in that book's folder; otherwise start from root

Callers

nothing calls this directly

Calls 2

existsMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected