From 993f92e4125a2641997ac72106eb45c19750311b Mon Sep 17 00:00:00 2001 From: shweet Date: Tue, 11 Nov 2025 18:54:57 -0500 Subject: [PATCH] fix for filepath to string conversions --- src/document.cpp | 4 ++-- src/document.h | 1 - src/imgui/taskbar.cpp | 4 ++-- src/imgui/window/sounds.cpp | 6 +++--- src/imgui/window/spritesheets.cpp | 8 ++++---- src/render.cpp | 3 ++- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/document.cpp b/src/document.cpp index a110e87..48e5800 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -71,7 +71,7 @@ namespace anm2ed { this->path = !path.empty() ? path : this->path.string(); - if (anm2.serialize(this->path, errorString)) + if (anm2.serialize(this->path.string(), errorString)) { toasts.info(std::format("Saved document to: {}", this->path.string())); clean(); @@ -212,7 +212,7 @@ namespace anm2ed auto add = [&]() { int id{}; - if (anm2.spritesheet_add(directory_get(), path, id)) + if (anm2.spritesheet_add(directory_get().string(), path, id)) { anm2::Spritesheet& spritesheet = anm2.content.spritesheets[id]; this->spritesheet.selection = {id}; diff --git a/src/document.h b/src/document.h index 6043f2f..f681221 100644 --- a/src/document.h +++ b/src/document.h @@ -69,7 +69,6 @@ namespace anm2ed bool save(const std::string& = {}, std::string* = nullptr); void hash_set(); void clean(); - void on_change(); void change(ChangeType); bool is_dirty(); bool is_autosave_dirty(); diff --git a/src/imgui/taskbar.cpp b/src/imgui/taskbar.cpp index 169b438..c7e3bf2 100644 --- a/src/imgui/taskbar.cpp +++ b/src/imgui/taskbar.cpp @@ -68,8 +68,8 @@ namespace anm2ed::imgui if (ImGui::MenuItem("Save As", settings.shortcutSaveAs.c_str(), false, document)) dialog.file_save(dialog::ANM2_SAVE); - if (ImGui::MenuItem("Explore XML Location", nullptr, false, document)) - dialog.file_explorer_open(document->directory_get()); + if (ImGui::MenuItem("Explore XML Location", nullptr, false, document)) + dialog.file_explorer_open(document->directory_get().string()); ImGui::Separator(); if (ImGui::MenuItem("Exit", settings.shortcutExit.c_str())) isQuitting = true; diff --git a/src/imgui/window/sounds.cpp b/src/imgui/window/sounds.cpp index aa6421a..57e8505 100644 --- a/src/imgui/window/sounds.cpp +++ b/src/imgui/window/sounds.cpp @@ -73,7 +73,7 @@ namespace anm2ed::imgui { std::string errorString{}; document.snapshot("Paste Sound(s)"); - if (anm2.sounds_deserialize(clipboard.get(), document.directory_get(), type, &errorString)) + if (anm2.sounds_deserialize(clipboard.get(), document.directory_get().string(), type, &errorString)) document.change(Document::SOUNDS); else toasts.error(std::format("Failed to deserialize sound(s): {}", errorString)); @@ -131,7 +131,7 @@ namespace anm2ed::imgui auto add = [&]() { int id{}; - if (anm2.sound_add(document.directory_get(), dialog.path, id)) + if (anm2.sound_add(document.directory_get().string(), dialog.path, id)) { selection = {id}; toasts.info(std::format("Initialized sound #{}: {}", id, dialog.path)); @@ -145,4 +145,4 @@ namespace anm2ed::imgui dialog.reset(); } } -} \ No newline at end of file +} diff --git a/src/imgui/window/spritesheets.cpp b/src/imgui/window/spritesheets.cpp index 439f7e8..1fcc5f7 100644 --- a/src/imgui/window/spritesheets.cpp +++ b/src/imgui/window/spritesheets.cpp @@ -46,7 +46,7 @@ namespace anm2ed::imgui { std::string errorString{}; document.snapshot("Paste Spritesheet(s)"); - if (anm2.spritesheets_deserialize(clipboard.get(), document.directory_get(), type, &errorString)) + if (anm2.spritesheets_deserialize(clipboard.get(), document.directory_get().string(), type, &errorString)) document.change(Document::SPRITESHEETS); else toasts.error(std::format("Failed to deserialize spritesheet(s): {}", errorString)); @@ -208,7 +208,7 @@ namespace anm2ed::imgui for (auto& id : selection) { anm2::Spritesheet& spritesheet = anm2.content.spritesheets[id]; - spritesheet.reload(document.directory_get()); + spritesheet.reload(document.directory_get().string()); toasts.info(std::format("Reloaded spritesheet #{}: {}", id, spritesheet.path.string())); } }; @@ -234,7 +234,7 @@ namespace anm2ed::imgui { auto& id = *selection.begin(); anm2::Spritesheet& spritesheet = anm2.content.spritesheets[id]; - spritesheet = anm2::Spritesheet(document.directory_get(), dialog.path); + spritesheet = anm2::Spritesheet(document.directory_get().string(), dialog.path); toasts.info(std::format("Replaced spritesheet #{}: {}", id, spritesheet.path.string())); }; @@ -276,7 +276,7 @@ namespace anm2ed::imgui for (auto& id : selection) { anm2::Spritesheet& spritesheet = anm2.content.spritesheets[id]; - if (spritesheet.save(document.directory_get())) + if (spritesheet.save(document.directory_get().string())) toasts.info(std::format("Saved spritesheet #{}: {}", id, spritesheet.path.string())); else toasts.info(std::format("Unable to save spritesheet #{}: {}", id, spritesheet.path.string())); diff --git a/src/render.cpp b/src/render.cpp index ab7142d..19f6243 100644 --- a/src/render.cpp +++ b/src/render.cpp @@ -6,7 +6,6 @@ #include #ifdef _WIN32 - #include "util.h" #define POPEN _popen #define PCLOSE _pclose #define PWRITE_MODE "wb" @@ -19,7 +18,9 @@ #endif #include "log.h" +#include "string_.h" +using namespace anm2ed::util; using namespace anm2ed::resource; using namespace glm;