From 38ba02a68f872e494c7b8fe43a3ffda93bc43d31 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sun, 10 Apr 2016 15:55:01 -0700 Subject: [PATCH] Change File::open to File::open_for_writing. Not thrilled about the File API right now... --- firmware/application/file.cpp | 4 ++-- firmware/application/file.hpp | 2 +- firmware/common/png_writer.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/firmware/application/file.cpp b/firmware/application/file.cpp index 3695063d..0ea0f57e 100644 --- a/firmware/application/file.cpp +++ b/firmware/application/file.cpp @@ -25,13 +25,13 @@ File::~File() { close(); } -bool File::open(const std::string& file_path) { +bool File::open_for_writing(const std::string& file_path) { const auto open_result = f_open(&f, file_path.c_str(), FA_WRITE | FA_OPEN_ALWAYS); return (open_result == FR_OK); } bool File::open_for_append(const std::string& file_path) { - if( open(file_path) ) { + if( open_for_writing(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 29ffc57d..df391db7 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -32,7 +32,7 @@ class File { public: ~File(); - bool open(const std::string& file_path); + bool open_for_writing(const std::string& file_path); bool open_for_append(const std::string& file_path); bool close(); diff --git a/firmware/common/png_writer.cpp b/firmware/common/png_writer.cpp index 8a07326c..15e1b8aa 100644 --- a/firmware/common/png_writer.cpp +++ b/firmware/common/png_writer.cpp @@ -53,7 +53,7 @@ PNGWriter::PNGWriter( const std::string& filename ) { - file.open(filename); + file.open_for_writing(filename); file.write(png_file_header); file.write(png_ihdr_screen_capture);