Export app::readable_file for API use
This commit is contained in:
parent
685e09412b
commit
37b2586eaa
|
@ -11,6 +11,7 @@ import coral.math;
|
|||
|
||||
import oar;
|
||||
|
||||
namespace app {
|
||||
struct file_reader : public coral::file_reader {
|
||||
enum class [[nodiscard]] close_result {
|
||||
ok,
|
||||
|
@ -95,6 +96,7 @@ struct file_reader : public coral::file_reader {
|
|||
|
||||
::SDL_RWops * rw_ops;
|
||||
};
|
||||
}
|
||||
|
||||
struct base_directory : public coral::fs {
|
||||
base_directory() : directory_path{} {
|
||||
|
@ -122,13 +124,13 @@ struct base_directory : public coral::fs {
|
|||
void read_file(coral::path const & file_path, coral::callable<void(coral::file_reader &)> const & then) override {
|
||||
if (this->directory_path.length == 0) return;
|
||||
|
||||
file_reader reader{this};
|
||||
app::file_reader reader{this};
|
||||
|
||||
if (reader.open(file_path) != file_reader::open_result::ok) return;
|
||||
if (reader.open(file_path) != app::file_reader::open_result::ok) return;
|
||||
|
||||
then(reader);
|
||||
|
||||
if (reader.close() != file_reader::close_result::ok) return;
|
||||
if (reader.close() != app::file_reader::close_result::ok) return;
|
||||
}
|
||||
|
||||
void write_file(coral::path const & file_path, coral::callable<void(coral::file_writer &)> const & then) override {
|
||||
|
@ -165,13 +167,13 @@ struct user_directory : public coral::fs {
|
|||
void read_file(coral::path const & file_path, coral::callable<void(coral::file_reader &)> const & then) override {
|
||||
if (this->directory_path.length == 0) return;
|
||||
|
||||
file_reader reader{this};
|
||||
app::file_reader reader{this};
|
||||
|
||||
if (reader.open(file_path) != file_reader::open_result::ok) return;
|
||||
if (reader.open(file_path) != app::file_reader::open_result::ok) return;
|
||||
|
||||
then(reader);
|
||||
|
||||
if (reader.close() != file_reader::close_result::ok) return;
|
||||
if (reader.close() != app::file_reader::close_result::ok) return;
|
||||
}
|
||||
|
||||
void write_file(coral::path const & file_path, coral::callable<void(coral::file_writer &)> const & then) override {
|
||||
|
|
Loading…
Reference in New Issue