galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
galaxy::fileutils Namespace Reference

Functions

std::optional< std::string > extension (const std::string &filepath) noexcept
 Get a file or path's extension.
 
std::expected< std::string, FileErrorread (const std::string &filepath)
 Read a non-binary file on disk.
 
std::optional< FileErrorwrite (const std::string &filepath, const std::string &data)
 Writes a non-binary file to disk.
 

Function Documentation

◆ extension()

std::optional< std::string > galaxy::fileutils::extension ( const std::string & filepath)
nodiscardnoexcept

Get a file or path's extension.

Parameters
filepathFilename or path with a filename.
Returns
Extension, including dot. Nullopt if errors.

Definition at line 16 of file FileUtils.cpp.

+ Here is the caller graph for this function:

◆ read()

std::expected< std::string, FileError > galaxy::fileutils::read ( const std::string & filepath)
nodiscard

Read a non-binary file on disk.

Parameters
filepathPath to file to read.
Returns
Data, or filerror if an unexpected error occured.

Definition at line 27 of file FileUtils.cpp.

+ Here is the caller graph for this function:

◆ write()

std::optional< FileError > galaxy::fileutils::write ( const std::string & filepath,
const std::string & data )
nodiscard

Writes a non-binary file to disk.

Parameters
filepathPath to file to write to.
dataData to write to file.
Returns
Nullopt on success, FileError on failure.

Definition at line 56 of file FileUtils.cpp.

+ Here is the caller graph for this function: