From 21b66d833733c186b761541a9486ed161fd6de65 Mon Sep 17 00:00:00 2001 From: shweet Date: Sat, 13 Dec 2025 02:51:10 -0500 Subject: [PATCH] checking... --- src/anm2/anm2.cpp | 16 ++++++++++++---- src/util/filesystem_.cpp | 13 ------------- src/util/filesystem_.h | 9 --------- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/anm2/anm2.cpp b/src/anm2/anm2.cpp index 0bc0bb5..f6151f8 100644 --- a/src/anm2/anm2.cpp +++ b/src/anm2/anm2.cpp @@ -23,9 +23,13 @@ namespace anm2ed::anm2 { XMLDocument document; - filesystem::File file{path, "rb"}; +#ifdef _WIN32 + auto file = _wfopen(path.string().c_str(), L"rb"); +#else + auto file = fopen(path.c_str(), "rb"); +#endif - if (!file.get() || document.LoadFile(file.get()) != XML_SUCCESS) + if (!file || document.LoadFile(file) != XML_SUCCESS) { if (errorString) *errorString = document.ErrorStr(); return; @@ -58,9 +62,13 @@ namespace anm2ed::anm2 XMLDocument document; document.InsertFirstChild(to_element(document)); - filesystem::File file{path, "w"}; +#ifdef _WIN32 + auto file = _wfopen(path.string().c_str(), L"w"); +#else + auto file = fopen(path.c_str(), "w"); +#endif - if (!file.get() || document.SaveFile(file.get()) != XML_SUCCESS) + if (!file || document.SaveFile(file) != XML_SUCCESS) { if (errorString) *errorString = document.ErrorStr(); return false; diff --git a/src/util/filesystem_.cpp b/src/util/filesystem_.cpp index f50c622..a4471e6 100644 --- a/src/util/filesystem_.cpp +++ b/src/util/filesystem_.cpp @@ -20,19 +20,6 @@ namespace anm2ed::util::filesystem } } - File::File(const std::filesystem::path& path, const char* mode) - { -#ifdef _WIN32 - _wfopen_s(&this->internal, path.c_str(), mode); -#else - this->internal = fopen(path.c_str(), mode); -#endif - } - - File::~File() { fclose(this->internal); } - - FILE* File::get() { return internal; } - std::filesystem::path path_preferences_get() { auto path = SDL_GetPrefPath(nullptr, "anm2ed"); diff --git a/src/util/filesystem_.h b/src/util/filesystem_.h index 44ce68b..7aa4a68 100644 --- a/src/util/filesystem_.h +++ b/src/util/filesystem_.h @@ -25,13 +25,4 @@ namespace anm2ed::util::filesystem ~WorkingDirectory(); }; - class File - { - public: - FILE* internal{}; - - File(const std::filesystem::path&, const char*); - ~File(); - FILE* get(); - }; }