rename 'files' to 'io'

This commit is contained in:
MihailRis
2025-01-30 16:53:52 +03:00
parent e5d558d357
commit 1e22882284
45 changed files with 157 additions and 160 deletions
+3 -3
View File
@@ -7,9 +7,9 @@
#include "content/Content.hpp"
#include "debug/Logger.hpp"
#include "engine/Engine.hpp"
#include "files/engine_paths.hpp"
#include "files/files.hpp"
#include "files/settings_io.hpp"
#include "io/engine_paths.hpp"
#include "io/io.hpp"
#include "io/settings_io.hpp"
#include "frontend/menu.hpp"
#include "frontend/screens/MenuScreen.hpp"
#include "graphics/core/Texture.hpp"
+7 -7
View File
@@ -4,8 +4,8 @@
#include "coders/gzip.hpp"
#include "engine/Engine.hpp"
#include "files/engine_paths.hpp"
#include "files/files.hpp"
#include "io/engine_paths.hpp"
#include "io/io.hpp"
#include "util/stringutil.hpp"
#include "api_lua.hpp"
#include "../lua_engine.hpp"
@@ -41,7 +41,7 @@ static int l_resolve(lua::State* L) {
static int l_read(lua::State* L) {
fs::path path = resolve_path(lua::require_string(L, 1));
if (fs::is_regular_file(path)) {
return lua::pushstring(L, files::read_string(path));
return lua::pushstring(L, io::read_string(path));
}
throw std::runtime_error(
"file does not exists " + util::quote(path.u8string())
@@ -65,7 +65,7 @@ static fs::path get_writeable_path(lua::State* L) {
static int l_write(lua::State* L) {
fs::path path = get_writeable_path(L);
std::string text = lua::require_string(L, 2);
files::write_string(path, text);
io::write_string(path, text);
return 1;
}
@@ -128,7 +128,7 @@ static int l_read_bytes(lua::State* L) {
if (fs::is_regular_file(path)) {
size_t length = static_cast<size_t>(fs::file_size(path));
auto bytes = files::read_bytes(path, length);
auto bytes = io::read_bytes(path, length);
lua::createtable(L, length, 0);
int newTable = lua::gettop(L);
@@ -150,14 +150,14 @@ static int l_write_bytes(lua::State* L) {
if (auto bytearray = lua::touserdata<lua::LuaBytearray>(L, 2)) {
auto& bytes = bytearray->data();
return lua::pushboolean(
L, files::write_bytes(path, bytes.data(), bytes.size())
L, io::write_bytes(path, bytes.data(), bytes.size())
);
}
std::vector<ubyte> bytes;
lua::read_bytes_from_table(L, 2, bytes);
return lua::pushboolean(
L, files::write_bytes(path, bytes.data(), bytes.size())
L, io::write_bytes(path, bytes.data(), bytes.size())
);
}
@@ -1,7 +1,7 @@
#include "api_lua.hpp"
#include "files/files.hpp"
#include "files/util.hpp"
#include "io/io.hpp"
#include "io/util.hpp"
#include "coders/binary_json.hpp"
#include "world/Level.hpp"
#include "world/generator/VoxelFragment.hpp"
@@ -17,7 +17,7 @@ static int l_save_fragment(lua::State* L) {
auto file = paths.resolve(lua::require_string(L, 2), true);
auto map = fragment->getFragment()->serialize();
auto bytes = json::to_binary(map, true);
files::write_bytes(file, bytes.data(), bytes.size());
io::write_bytes(file, bytes.data(), bytes.size());
return 0;
}
@@ -41,7 +41,7 @@ static int l_load_fragment(lua::State* L) {
if (!std::filesystem::exists(path)) {
throw std::runtime_error("file "+path.u8string()+" does not exist");
}
auto map = files::read_binary_json(path);
auto map = io::read_binary_json(path);
auto fragment = std::make_shared<VoxelFragment>();
fragment->deserialize(map);
+2 -2
View File
@@ -1,7 +1,7 @@
#include <filesystem>
#include "engine/Engine.hpp"
#include "files/files.hpp"
#include "io/io.hpp"
#include "frontend/hud.hpp"
#include "frontend/screens/Screen.hpp"
#include "graphics/ui/GUI.hpp"
@@ -141,7 +141,7 @@ static void resetPackBindings(fs::path& packFolder) {
if (fs::is_regular_file(bindsFile)) {
Events::loadBindings(
bindsFile.u8string(),
files::read_string(bindsFile),
io::read_string(bindsFile),
BindType::REBIND
);
}
+1 -1
View File
@@ -8,7 +8,7 @@
#include "content/Content.hpp"
#include "engine/Engine.hpp"
#include "world/files/WorldFiles.hpp"
#include "files/engine_paths.hpp"
#include "io/engine_paths.hpp"
#include "world/Level.hpp"
#include "world/World.hpp"
#include "api_lua.hpp"
+3 -3
View File
@@ -7,8 +7,8 @@
#include "coders/json.hpp"
#include "engine/Engine.hpp"
#include "world/files/WorldFiles.hpp"
#include "files/engine_paths.hpp"
#include "files/files.hpp"
#include "io/engine_paths.hpp"
#include "io/io.hpp"
#include "lighting/Lighting.hpp"
#include "voxels/Chunk.hpp"
#include "voxels/Chunks.hpp"
@@ -44,7 +44,7 @@ static int l_get_list(lua::State* L) {
const auto& folder = worlds[i];
auto root =
json::parse(files::read_string(folder / fs::u8path("world.json")));
json::parse(io::read_string(folder / fs::u8path("world.json")));
const auto& versionMap = root["version"];
int versionMajor = versionMap["major"].asInteger();
int versionMinor = versionMap["minor"].asInteger();
+3 -3
View File
@@ -3,8 +3,8 @@
#include <iomanip>
#include <iostream>
#include "files/files.hpp"
#include "files/engine_paths.hpp"
#include "io/io.hpp"
#include "io/engine_paths.hpp"
#include "debug/Logger.hpp"
#include "util/stringutil.hpp"
#include "libs/api_lua.hpp"
@@ -161,7 +161,7 @@ State* lua::create_state(const EnginePaths& paths, StateType stateType) {
auto resDir = paths.getResourcesFolder();
auto file = resDir / fs::u8path("scripts/stdmin.lua");
auto src = files::read_string(file);
auto src = io::read_string(file);
lua::pop(L, lua::execute(L, 0, src, "core:scripts/stdmin.lua"));
return L;
}
@@ -9,7 +9,7 @@
#define FNL_IMPL
#include "maths/FastNoiseLite.h"
#include "coders/imageio.hpp"
#include "files/util.hpp"
#include "io/util.hpp"
#include "graphics/core/ImageData.hpp"
#include "maths/Heightmap.hpp"
#include "engine/Engine.hpp"