Attempt to be consistent with conversions between std::string and wxString.

This commit is contained in:
Jordan Woyak
2013-02-27 22:37:38 -06:00
parent e82d976d2f
commit 56f09d3b91
39 changed files with 344 additions and 300 deletions

View File

@ -20,12 +20,14 @@
#include <wx/wx.h>
#include <wx/string.h>
#include "WxUtils.h"
namespace WxUtils {
// Launch a file according to its mime type
void Launch(const char *filename)
{
if (! ::wxLaunchDefaultBrowser(wxString(filename, *wxConvCurrent)))
if (! ::wxLaunchDefaultBrowser(StrToWxStr(filename)))
{
// WARN_LOG
}
@ -34,7 +36,7 @@ void Launch(const char *filename)
// Launch an file explorer window on a certain path
void Explore(const char *path)
{
wxString wxPath = wxString(path, *wxConvCurrent);
wxString wxPath = StrToWxStr(path);
// Default to file
if (! wxPath.Contains(wxT("://")))
{
@ -52,3 +54,13 @@ void Explore(const char *path)
}
} // namespace
std::string WxStrToStr(const wxString& str)
{
return str.ToUTF8();
}
wxString StrToWxStr(const std::string& str)
{
return wxString::FromUTF8(str.c_str());
}