97     [[nodiscard]] 
bool is_open() 
const;
 
  110     static bool file_exists(
const std::string& file_path);
 
  128     [[nodiscard]] std::string 
get_path() 
const;
 
  142     bool store_bytes(
const std::vector<char>& content);
 
  148     void seek(
int length);
 
  170     SDL_IOStream* _file = 
nullptr; 
 
  171     std::string _file_path; 
 
  173     bool resolve_path(
const std::string& file_path, 
ModeFlags mode_flags);
 
A RAII wrapper for SDL3 file operations supporting read/write access.
Definition: file_system.h:64
void seek(int length)
Move the file pointer to the given offset from the beginning.
Definition: file_system.cpp:164
~FileAccess()
Destructor automatically closes the file if it is open.
Definition: file_system.cpp:112
FileAccess()=default
Default constructor (empty, file not opened)
std::string get_path() const
Get the path relative to the base (removes res:// or user:// prefix)
Definition: file_system.cpp:176
std::vector< char > get_file_as_bytes()
Read the entire file as a vector of bytes.
Definition: file_system.cpp:120
void seek_end(int position)
Move the file pointer relative to the end of the file.
Definition: file_system.cpp:168
bool store_string(const std::string &content="")
Write a string to the file.
Definition: file_system.cpp:185
bool store_bytes(const std::vector< char > &content)
Write a byte array to the file.
Definition: file_system.cpp:200
FileAccess & operator=(const FileAccess &)=delete
bool open(const std::string &file_path, ModeFlags mode_flags=ModeFlags::READ)
Open a file for reading/writing.
Definition: file_system.cpp:92
FileAccess(const FileAccess &)=delete
SDL_IOStream * get_handle() const
Definition: file_system.h:165
std::string get_file_as_str()
Read the entire file as a String.
Definition: file_system.cpp:137
static bool file_exists(const std::string &file_path)
Check if a file exists at the given path.
Definition: file_system.cpp:142
bool is_open() const
Check if the file is currently open.
Definition: file_system.cpp:116
std::string get_absolute_path() const
Get the absolute resolved path to the file.
Definition: file_system.cpp:172
void close()
Close the file if it is open.
Definition: file_system.cpp:216
std::string load_assets_file(const std::string &file_path)
Loads a given file from res folder.
Definition: file_system.cpp:5
ModeFlags
Flags to indicate access modes.
Definition: file_system.h:50
std::vector< char > load_file_into_memory(const std::string &file_path)
Loads a given file from res folder into memory.
Definition: file_system.cpp:14
@ READ_WRITE
Read then Write access.
@ WRITE
Write-only access.
@ WRITE_READ
Write then Read access.
Ember file (SDL_stream)
Definition: file_system.h:34
SDL_IOStream * stream
Definition: file_system.h:35