forked from Ivasoft/DSView
fix: Maybe got an error text code on windows
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include "path.h"
|
||||
#ifdef _WIN32
|
||||
#include <QTextCodec>
|
||||
#include "../log.h"
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace pv{
|
||||
@@ -45,13 +47,19 @@ namespace path{
|
||||
std::string ToUnicodePath(QString path)
|
||||
{
|
||||
std::string str;
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
QTextCodec *codec = QTextCodec::codecForLocale();
|
||||
QByteArray str_tmp = codec->fromUnicode(path);
|
||||
str = str_tmp.data();
|
||||
QTextCodec *codec = QTextCodec::codecForName("System");
|
||||
if (codec != NULL){
|
||||
QByteArray str_tmp = codec->fromUnicode(path);
|
||||
str = str_tmp.data();
|
||||
}
|
||||
else{
|
||||
dsv_err("Error: can't get \"System\" page code");
|
||||
str = path.toUtf8().data();
|
||||
}
|
||||
#else
|
||||
str = path.toUtf8().data();
|
||||
str = path.toUtf8().data();
|
||||
#endif
|
||||
|
||||
return str;
|
||||
|
||||
Reference in New Issue
Block a user