diff --git a/firmware/application/file.cpp b/firmware/application/file.cpp index 0ea0f57eb..a14325e06 100644 --- a/firmware/application/file.cpp +++ b/firmware/application/file.cpp @@ -30,6 +30,11 @@ bool File::open_for_writing(const std::string& file_path) { return (open_result == FR_OK); } +bool File::open_for_reading(const std::string& file_path) { + const auto open_result = f_open(&f, file_path.c_str(), FA_READ | FA_OPEN_EXISTING); + return (open_result == FR_OK); +} + bool File::open_for_append(const std::string& file_path) { if( open_for_writing(file_path) ) { const auto seek_result = f_lseek(&f, f_size(&f)); diff --git a/firmware/application/file.hpp b/firmware/application/file.hpp index df391db7c..5a4524cf1 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -33,6 +33,7 @@ public: ~File(); bool open_for_writing(const std::string& file_path); + bool open_for_reading(const std::string& file_path); bool open_for_append(const std::string& file_path); bool close();