8#ifndef GALAXY_FS_FILEUTILS_HPP_
9#define GALAXY_FS_FILEUTILS_HPP_
14#include <nlohmann/json_fwd.hpp>
30 std::optional<std::string>
extension(
const std::string& filepath)
noexcept;
40 std::expected<std::string, FileError>
read(
const std::string& filepath);
51 std::optional<FileError>
write(
const std::string& filepath,
const std::string& data);
61 std::optional<nlohmann::json>
read_json(
const std::string& filepath);
72 bool write_json(
const std::string& filepath,
const nlohmann::json& json);
79 void open_url(
const std::string& url)
noexcept;
std::optional< FileError > write(const std::string &filepath, const std::string &data)
Writes a non-binary file to disk.
void open_url(const std::string &url) noexcept
Open URL in default webbrowser.
std::optional< std::string > extension(const std::string &filepath) noexcept
Get a file or path's extension.
bool write_json(const std::string &filepath, const nlohmann::json &json)
Write json to disk.
std::expected< std::string, FileError > read(const std::string &filepath)
Read a non-binary file on disk.
std::optional< nlohmann::json > read_json(const std::string &filepath)
Read a json file from disk.