mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Add File::open(), use inside File::open_for_append().
This commit is contained in:
parent
6b97490794
commit
083711ceb2
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user