diff --git a/firmware/application/file.cpp b/firmware/application/file.cpp index 4898ee74d..3695063dc 100644 --- a/firmware/application/file.cpp +++ b/firmware/application/file.cpp @@ -25,9 +25,13 @@ File::~File() { close(); } -bool File::open_for_append(const std::string& file_path) { +bool File::open(const std::string& file_path) { const auto open_result = f_open(&f, file_path.c_str(), FA_WRITE | FA_OPEN_ALWAYS); - if( open_result == FR_OK ) { + return (open_result == FR_OK); +} + +bool File::open_for_append(const std::string& file_path) { + if( open(file_path) ) { const auto seek_result = f_lseek(&f, f_size(&f)); if( seek_result == FR_OK ) { return true; diff --git a/firmware/application/file.hpp b/firmware/application/file.hpp index 533bc4562..17ac5a7cd 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -31,6 +31,7 @@ class File { public: ~File(); + bool open(const std::string& file_path); bool open_for_append(const std::string& file_path); bool close();