diff options
| author | untodesu <kirill@untode.su> | 2025-12-26 23:17:56 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-12-26 23:17:56 +0500 |
| commit | 0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e (patch) | |
| tree | 90ddefa28b40b6384dd9618bb7573704de2733a9 /src/core/io/physfs.cc | |
| parent | 6bb4233d5b2a1688e63c947542e92ec5d5a857a6 (diff) | |
| download | voxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.tar.bz2 voxelius-0f111cf51b00c4e884b7e53b4fd7ff6e38d8af5e.zip | |
Add include guards and header comments to sources
Diffstat (limited to 'src/core/io/physfs.cc')
| -rw-r--r-- | src/core/io/physfs.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/io/physfs.cc b/src/core/io/physfs.cc index b9fe91e..04aaf64 100644 --- a/src/core/io/physfs.cc +++ b/src/core/io/physfs.cc @@ -1,13 +1,18 @@ +// SPDX-License-Identifier: BSD-2-Clause +// Copyright (c) 2025 Kirill Dmitrievich +// File: physfs.cc +// Description: PhysFS utilities + #include "core/pch.hh" #include "core/io/physfs.hh" -bool read_file(std::string_view path, std::vector<std::byte>& buffer) +bool physfs::read_file(std::string_view path, std::vector<std::byte>& buffer) { auto file = PHYSFS_openRead(std::string(path).c_str()); if(file == nullptr) { - spdlog::error("physfs: {}: {}", path, physfs_error()); + spdlog::error("physfs: {}: {}", path, physfs::last_error()); return false; } @@ -20,12 +25,12 @@ bool read_file(std::string_view path, std::vector<std::byte>& buffer) return true; } -bool read_file(std::string_view path, std::string& buffer) +bool physfs::read_file(std::string_view path, std::string& buffer) { auto file = PHYSFS_openRead(std::string(path).c_str()); if(file == nullptr) { - spdlog::error("physfs: {}: {}", path, physfs_error()); + spdlog::error("physfs: {}: {}", path, physfs::last_error()); return false; } @@ -38,12 +43,12 @@ bool read_file(std::string_view path, std::string& buffer) return true; } -bool write_file(std::string_view path, const std::vector<std::byte>& buffer) +bool physfs::write_file(std::string_view path, const std::vector<std::byte>& buffer) { auto file = PHYSFS_openWrite(std::string(path).c_str()); if(file == nullptr) { - spdlog::error("physfs: {}: {}", path, physfs_error()); + spdlog::error("physfs: {}: {}", path, physfs::last_error()); return false; } @@ -53,12 +58,12 @@ bool write_file(std::string_view path, const std::vector<std::byte>& buffer) return true; } -bool write_file(std::string_view path, const std::string& buffer) +bool physfs::write_file(std::string_view path, const std::string& buffer) { auto file = PHYSFS_openWrite(std::string(path).c_str()); if(file == nullptr) { - spdlog::error("physfs: {}: {}", path, physfs_error()); + spdlog::error("physfs: {}: {}", path, physfs::last_error()); return false; } @@ -68,7 +73,7 @@ bool write_file(std::string_view path, const std::string& buffer) return true; } -std::string_view physfs_error(void) +std::string_view physfs::last_error(void) { auto error_code = PHYSFS_getLastErrorCode(); auto error_string = PHYSFS_getErrorByCode(error_code); |
