Fix handling of non-ASCII characters when resizing file

This commit is contained in:
Martchus 2023-11-07 23:33:46 +01:00
parent 3da25a39a4
commit 9f134725c7
2 changed files with 3 additions and 2 deletions

View File

@ -46,7 +46,7 @@ endif ()
set(CONFIGURATION_PACKAGE_SUFFIX
""
CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities")
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.14.0 REQUIRED)
use_cpp_utilities(VISIBILITY PUBLIC)
# find 3rd party libraries

View File

@ -8,6 +8,7 @@
#include <c++utilities/conversion/stringbuilder.h>
#include <c++utilities/conversion/stringconversion.h>
#include <c++utilities/io/path.h>
#include <openssl/conf.h>
#include <openssl/err.h>
@ -430,7 +431,7 @@ void PasswordFile::save(PasswordFileSaveFlags options)
const auto newSize = static_cast<std::size_t>(m_file.tellp());
if (fileSize && newSize < fileSize) {
m_file.close();
std::filesystem::resize_file(m_path, newSize);
std::filesystem::resize_file(makeNativePath(m_path), newSize);
}
}