mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Change File::open to File::open_for_writing.
Not thrilled about the File API right now...
This commit is contained in:
parent
df6593ac91
commit
38ba02a68f
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user