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
FileUtils.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_FS_FILEUTILS_HPP_
9#define GALAXY_FS_FILEUTILS_HPP_
10
11#include <expected>
12#include <optional>
13
15
16namespace galaxy
17{
18 namespace fileutils
19 {
27 [[nodiscard]]
28 std::optional<std::string> extension(const std::string& filepath) noexcept;
29
37 [[nodiscard]]
38 std::expected<std::string, FileError> read(const std::string& filepath);
39
48 [[nodiscard]]
49 std::optional<FileError> write(const std::string& filepath, const std::string& data);
50 } // namespace fileutils
51} // namespace galaxy
52
53#endif
std::optional< FileError > write(const std::string &filepath, const std::string &data)
Writes a non-binary file to disk.
Definition FileUtils.cpp:56
std::optional< std::string > extension(const std::string &filepath) noexcept
Get a file or path's extension.
Definition FileUtils.cpp:16
std::expected< std::string, FileError > read(const std::string &filepath)
Read a non-binary file on disk.
Definition FileUtils.cpp:27
Timer.hpp galaxy.
Definition Timer.cpp:18