Enhance Misc::StringUtils::format
There are issues with current formatting implementation:
-
snprintf
can return -1 if formatting fails (e.g. when format string has an invalid format) and it is unclear what to do in this case. - For some reason
snprintf
actually sometimes returns -1 on Android on some devices, even in valid cases.
Ideally we can replace our custom solution to std::format
once OpenMW will support C++20. As an alternative solution, it should be possible to use Boost formatting, something like this:
#include <boost/format.hpp>
template <typename ... Args>
static std::string format(const char* fmt, Args const & ... args)
{
return boost::str((boost::format(fmt) % ... % args));
}
Edited by jvoisin