checking...

This commit is contained in:
2025-12-13 02:51:10 -05:00
parent 4977f4476c
commit 21b66d8337
3 changed files with 12 additions and 26 deletions

View File

@@ -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;