mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-02-02 13:52:55 +08:00
fix: Maybe got an error text code on windows
This commit is contained in:
parent
2a1e1b464f
commit
f2bc9ee72f
@ -22,6 +22,8 @@
|
||||
#include "path.h"
|
||||
#ifdef _WIN32
|
||||
#include <QTextCodec>
|
||||
#include "../log.h"
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace pv{
|
||||
@ -47,9 +49,15 @@ namespace 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();
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user