mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
migrate from std::filesystem::path to io::path (WIP)
This commit is contained in:
parent
1e22882284
commit
e0314803c0
72 changed files with 1189 additions and 791 deletions
|
|
@ -32,11 +32,11 @@ EngineController::EngineController(Engine& engine) : engine(engine) {
|
|||
}
|
||||
|
||||
void EngineController::deleteWorld(const std::string& name) {
|
||||
fs::path folder = engine.getPaths().getWorldFolderByName(name);
|
||||
io::path folder = engine.getPaths().getWorldFolderByName(name);
|
||||
|
||||
auto deletion = [this, folder]() {
|
||||
logger.info() << "deleting " << folder;
|
||||
fs::remove_all(folder);
|
||||
logger.info() << "deleting " << folder.string();
|
||||
io::remove_all(folder);
|
||||
if (!engine.isHeadless()) {
|
||||
engine.getGUI()->getMenu()->back();
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ void EngineController::deleteWorld(const std::string& name) {
|
|||
guiutil::confirm(
|
||||
engine,
|
||||
langs::get(L"delete-confirm", L"world") + L" (" +
|
||||
util::str2wstr_utf8(folder.u8string()) + L")",
|
||||
util::str2wstr_utf8(folder.string()) + L")",
|
||||
deletion
|
||||
);
|
||||
}
|
||||
|
|
@ -128,7 +128,7 @@ static void show_convert_request(
|
|||
);
|
||||
}
|
||||
|
||||
static bool load_world_content(Engine& engine, const fs::path& folder) {
|
||||
static bool load_world_content(Engine& engine, const io::path& folder) {
|
||||
if (engine.isHeadless()) {
|
||||
engine.loadWorldContent(folder);
|
||||
return true;
|
||||
|
|
@ -192,10 +192,10 @@ void EngineController::onMissingContent(const std::shared_ptr<ContentReport>& re
|
|||
|
||||
void EngineController::openWorld(const std::string& name, bool confirmConvert) {
|
||||
const auto& paths = engine.getPaths();
|
||||
auto folder = paths.getWorldsFolder() / fs::u8path(name);
|
||||
auto worldFile = folder / fs::u8path("world.json");
|
||||
if (!fs::exists(worldFile)) {
|
||||
throw std::runtime_error(worldFile.u8string() + " does not exists");
|
||||
auto folder = paths.getWorldsFolder() / name;
|
||||
auto worldFile = folder / "world.json";
|
||||
if (!io::exists(worldFile)) {
|
||||
throw std::runtime_error(worldFile.string() + " does not exists");
|
||||
}
|
||||
|
||||
if (!load_world_content(engine, folder)) {
|
||||
|
|
@ -257,7 +257,7 @@ void EngineController::createWorld(
|
|||
uint64_t seed = str2seed(seedstr);
|
||||
|
||||
EnginePaths& paths = engine.getPaths();
|
||||
auto folder = paths.getWorldsFolder() / fs::u8path(name);
|
||||
auto folder = paths.getWorldsFolder() / name;
|
||||
|
||||
if (engine.isHeadless()) {
|
||||
engine.loadContent();
|
||||
|
|
@ -288,7 +288,7 @@ void EngineController::setLocalPlayer(int64_t player) {
|
|||
}
|
||||
|
||||
void EngineController::reopenWorld(World* world) {
|
||||
std::string name = world->wfile->getFolder().filename().u8string();
|
||||
std::string name = world->wfile->getFolder().name();
|
||||
engine.onWorldClosed();
|
||||
openWorld(name, true);
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ void EngineController::reconfigPacks(
|
|||
runnable removeFunc = [this, controller, packsToAdd, packsToRemove]() {
|
||||
if (controller == nullptr) {
|
||||
try {
|
||||
auto manager = engine.createPacksManager(fs::path(""));
|
||||
auto manager = engine.createPacksManager("");
|
||||
manager.scan();
|
||||
auto names = PacksManager::getNames(engine.getContentPacks());
|
||||
for (const auto& id : packsToAdd) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue