2
0
forked from Ivasoft/DSView

update: Firmware resource path support UNICODE

This commit is contained in:
dreamsourcelabTAI
2022-08-09 14:23:11 +08:00
parent bb06d1cccd
commit e07673dcae
2 changed files with 13 additions and 3 deletions

View File

@@ -53,7 +53,7 @@ void usage()
" -h, -?, --help Show help option\n"
"\n", DS_BIN_NAME, DS_DESCRIPTION);
}
int main(int argc, char *argv[])
{

View File

@@ -32,6 +32,8 @@
#include "dsvdef.h"
#include "config/appconfig.h"
#include "log.h"
#include <QTextCodec>
#include <string.h>
AppControl::AppControl()
{
@@ -80,9 +82,17 @@ bool AppControl::Init()
_session->set_sr_context(sr_ctx);
QString resdir = GetResourceDir();
sr_set_firmware_resource_dir(resdir.toUtf8().data());
char res_path[256] = {0};
#ifdef _WIN32
QTextCodec *codec = QTextCodec::codecForName("System");
QByteArray str_tmp = codec->fromUnicode(resdir);
strncpy(res_path, str_tmp.data(), sizeof(res_path) - 1);
#else
strncpy(res_path, resdir.toUtf8().data(), sizeof(res_path) - 1);
#endif
sr_set_firmware_resource_dir(res_path);
#if defined(_WIN32) && defined(DEBUG_INFO)
//able run debug with qtcreator
QString pythonHome = "c:/python";
QDir pydir;