From e07673dcae44bd481d90667107e31929c249a44d Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Tue, 9 Aug 2022 14:23:11 +0800 Subject: [PATCH] update: Firmware resource path support UNICODE --- DSView/main.cpp | 2 +- DSView/pv/appcontrol.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/DSView/main.cpp b/DSView/main.cpp index cc430ea6..be706e98 100644 --- a/DSView/main.cpp +++ b/DSView/main.cpp @@ -53,7 +53,7 @@ void usage() " -h, -?, --help Show help option\n" "\n", DS_BIN_NAME, DS_DESCRIPTION); } - + int main(int argc, char *argv[]) { diff --git a/DSView/pv/appcontrol.cpp b/DSView/pv/appcontrol.cpp index de318ee1..c1e6ac17 100644 --- a/DSView/pv/appcontrol.cpp +++ b/DSView/pv/appcontrol.cpp @@ -32,6 +32,8 @@ #include "dsvdef.h" #include "config/appconfig.h" #include "log.h" +#include +#include 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;