Change File::open to File::open_for_writing.

Not thrilled about the File API right now...
This commit is contained in:
Jared Boone 2016-04-10 15:55:01 -07:00
parent df6593ac91
commit 38ba02a68f
3 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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();

View File

@ -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);