MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / openFile

Method openFile

Tactility/Source/app/notes/Notes.cpp:84–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82#pragma region Open_Events_Functions
83
84 void openFile(const std::string& path) {
85 // We might be reading from the SD card, which could share a SPI bus with other devices (display)
86 file::getLock(path)->withLock([this, path] {
87 auto data = file::readString(path);
88 if (data != nullptr) {
89 auto lock = lvgl::getSyncLock()->asScopedLock();
90 lock.lock();
91 lv_textarea_set_text(uiNoteText, reinterpret_cast<const char*>(data.get()));
92 lv_label_set_text(uiCurrentFileName, path.c_str());
93 filePath = path;
94 LOGGER.info("Loaded from {}", path);
95 }
96 });
97 }
98
99 bool saveFile(const std::string& path) {
100 // We might be writing to SD card, which could share a SPI bus with other devices (display)

Callers

nothing calls this directly

Calls 8

getLockFunction · 0.85
readStringFunction · 0.85
getSyncLockFunction · 0.85
withLockMethod · 0.80
asScopedLockMethod · 0.80
infoMethod · 0.80
lockMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected