Fileman default open and Screenshot viewer (#1102)

* WIP expensive way

* Add default file handling to fileman

* Remove screenshot_reader and tests

* Read data in chunks

* Format

* Fix error text position

* PR feedback

---------

Co-authored-by: kallanreed <kallanreed@outlook.com>
This commit is contained in:
Kyle Reed 2023-06-03 19:26:39 -07:00 committed by GitHub
parent f66f438487
commit e5728b3501
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 243 additions and 61 deletions

View file

@ -85,9 +85,13 @@ File::Result<File::Size> File::write(const void* data, Size bytes_to_write) {
}
}
File::Offset File::tell() const {
return f_tell(&f);
}
File::Result<File::Offset> File::seek(Offset new_position) {
/* NOTE: Returns *old* position, not new position */
const auto old_position = f_tell(&f);
const auto old_position = tell();
const auto result = f_lseek(&f, new_position);
if (result != FR_OK) {
return {static_cast<Error>(result)};