Fix fs::path <-> wxString conversions

This commit is contained in:
Vojtech Kral 2019-01-02 15:11:05 +01:00
parent 760b1cd9bc
commit 2db0906071
6 changed files with 51 additions and 26 deletions

View file

@ -4,6 +4,7 @@
#include "WipeTowerDialog.hpp"
#include <assert.h>
#include <string>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
@ -314,6 +315,20 @@ std::string into_u8(const wxString &str)
return std::string(buffer_utf8.data());
}
wxString from_path(const boost::filesystem::path &path)
{
#ifdef _WIN32
return wxString(path.string<std::wstring>());
#else
return wxString::FromUTF8(path.string<std::string>());
#endif
}
boost::filesystem::path into_path(const wxString &str)
{
return boost::filesystem::path(str.wx_str());
}
bool get_current_screen_size(wxWindow *window, unsigned &width, unsigned &height)
{
const auto idx = wxDisplay::GetFromWindow(window);