mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 12:01:50 +00:00
the final rename
This commit is contained in:
parent
f27a418dbe
commit
1627e21c1d
196 changed files with 836 additions and 815 deletions
61
src/files/engine_paths.hpp
Normal file
61
src/files/engine_paths.hpp
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#ifndef FILES_ENGINE_PATHS_HPP_
|
||||
#define FILES_ENGINE_PATHS_HPP_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <filesystem>
|
||||
|
||||
#include "../content/ContentPack.hpp"
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
class files_access_error : public std::runtime_error {
|
||||
public:
|
||||
files_access_error(const std::string& msg) : std::runtime_error(msg) {}
|
||||
};
|
||||
|
||||
class EnginePaths {
|
||||
fs::path userfiles {"."};
|
||||
fs::path resources {"res"};
|
||||
fs::path worldFolder;
|
||||
std::vector<ContentPack>* contentPacks = nullptr;
|
||||
public:
|
||||
fs::path getUserfiles() const;
|
||||
fs::path getResources() const;
|
||||
|
||||
fs::path getScreenshotFile(std::string ext);
|
||||
fs::path getWorldsFolder();
|
||||
fs::path getWorldFolder();
|
||||
fs::path getWorldFolder(const std::string& name);
|
||||
fs::path getControlsFile();
|
||||
fs::path getSettingsFile();
|
||||
bool isWorldNameUsed(std::string name);
|
||||
|
||||
void setUserfiles(fs::path folder);
|
||||
void setResources(fs::path folder);
|
||||
void setContentPacks(std::vector<ContentPack>* contentPacks);
|
||||
void setWorldFolder(fs::path folder);
|
||||
|
||||
std::vector<fs::path> scanForWorlds();
|
||||
|
||||
fs::path resolve(std::string path);
|
||||
};
|
||||
|
||||
class ResPaths {
|
||||
fs::path mainRoot;
|
||||
std::vector<std::pair<std::string, fs::path>> roots;
|
||||
public:
|
||||
ResPaths(
|
||||
fs::path mainRoot,
|
||||
std::vector<std::pair<std::string, fs::path>> roots
|
||||
);
|
||||
|
||||
fs::path find(const std::string& filename) const;
|
||||
std::string findRaw(const std::string& filename) const;
|
||||
std::vector<fs::path> listdir(const std::string& folder) const;
|
||||
|
||||
const fs::path& getMainRoot() const;
|
||||
};
|
||||
|
||||
#endif // FILES_ENGINE_PATHS_HPP_
|
||||
Loading…
Add table
Add a link
Reference in a new issue