forked from Ivasoft/DSView
fix: Unable to load chinese name file
This commit is contained in:
@@ -64,29 +64,31 @@ void AppControl::Destroy(){
|
||||
}
|
||||
|
||||
bool AppControl::Init()
|
||||
{
|
||||
{
|
||||
pv::encoding::init();
|
||||
|
||||
QString qs;
|
||||
std::string cs;
|
||||
|
||||
qs = GetAppDataDir();
|
||||
cs = qs.toStdString();
|
||||
cs = pv::path::ToUnicodePath(qs);
|
||||
dsv_info("GetAppDataDir:\"%s\"", cs.c_str());
|
||||
|
||||
qs = GetResourceDir();
|
||||
cs = qs.toStdString();
|
||||
cs = pv::path::ToUnicodePath(qs);
|
||||
dsv_info("GetResourceDir:\"%s\"", cs.c_str());
|
||||
|
||||
qs = GetUserDataDir();
|
||||
cs = qs.toStdString();
|
||||
cs = pv::path::ToUnicodePath(qs);
|
||||
dsv_info("GetUserDataDir:\"%s\"", cs.c_str());
|
||||
|
||||
qs = GetDecodeScriptDir();
|
||||
cs = qs.toStdString();
|
||||
cs = pv::path::ToUnicodePath(qs);
|
||||
dsv_info("GetDecodeScriptDir:\"%s\"", cs.c_str());
|
||||
//---------------end print directorys.
|
||||
|
||||
_session->init();
|
||||
pv::encoding::init();
|
||||
|
||||
srd_log_set_context(dsv_log_context());
|
||||
|
||||
#if defined(_WIN32) && defined(DEBUG_INFO)
|
||||
|
||||
@@ -290,15 +290,17 @@ namespace pv
|
||||
// Try load from file.
|
||||
QString ldFileName(AppControl::Instance()->_open_file_name.c_str());
|
||||
if (ldFileName != "")
|
||||
{
|
||||
{
|
||||
std::string file_name = pv::path::ToUnicodePath(ldFileName);
|
||||
|
||||
if (QFile::exists(ldFileName))
|
||||
{
|
||||
dsv_info("auto load file:%s", ldFileName.toUtf8().data());
|
||||
{
|
||||
dsv_info("Auto load file:%s", file_name.c_str());
|
||||
on_load_file(ldFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
dsv_err("file is not exists:%s", ldFileName.toUtf8().data());
|
||||
dsv_err("file is not exists:%s", file_name.c_str());
|
||||
MsgBox::Show(L_S(STR_PAGE_MSG, S_ID(IDS_MSG_OPEN_FILE_ERROR), "Open file error!"), ldFileName, NULL);
|
||||
}
|
||||
}
|
||||
@@ -606,13 +608,14 @@ namespace pv
|
||||
assert(false);
|
||||
}
|
||||
|
||||
dsv_info("Load session file: \"%s\"", name.toLocal8Bit().data());
|
||||
std::string file_name = pv::path::ToUnicodePath(name);
|
||||
dsv_info("Load session file: \"%s\"", file_name.c_str());
|
||||
|
||||
QFile sf(name);
|
||||
bool bDone;
|
||||
|
||||
if (!sf.exists()){
|
||||
dsv_warn("Warning: session file is not exists: \"%s\"", name.toLocal8Bit().data());
|
||||
if (!sf.exists()){
|
||||
dsv_warn("Warning: session file is not exists: \"%s\"", file_name.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1066,7 +1069,8 @@ namespace pv
|
||||
assert(false);
|
||||
}
|
||||
|
||||
dsv_info("Store session to file: \"%s\"", name.toLocal8Bit().data());
|
||||
std::string file_name = pv::path::ToUnicodePath(name);
|
||||
dsv_info("Store session to file: \"%s\"", file_name.c_str());
|
||||
|
||||
QFile sf(name);
|
||||
if (!sf.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
@@ -1696,10 +1700,12 @@ namespace pv
|
||||
break;
|
||||
|
||||
case DSV_MSG_COLLECT_END:
|
||||
dsv_info("Mainwindow:DSV_MSG_COLLECT_END");
|
||||
prgRate(0);
|
||||
_view->repeat_unshow();
|
||||
_view->on_state_changed(true);
|
||||
_protocol_widget->update_view_status();
|
||||
dsv_info("Mainwindow-end:DSV_MSG_COLLECT_END");
|
||||
break;
|
||||
|
||||
case DSV_MSG_END_COLLECT_WORK:
|
||||
|
||||
@@ -235,8 +235,10 @@ namespace pv
|
||||
|
||||
_device_agent.update();
|
||||
|
||||
if (_device_agent.is_file())
|
||||
dsv_info("Switch to file \"%s\" done.", _device_agent.name().toUtf8().data());
|
||||
if (_device_agent.is_file()){
|
||||
std::string dev_name = pv::path::ToUnicodePath(_device_agent.name());
|
||||
dsv_info("Switch to file \"%s\" done.", dev_name.c_str());
|
||||
}
|
||||
else
|
||||
dsv_info("Switch to device \"%s\" done.", _device_agent.name().toUtf8().data());
|
||||
|
||||
@@ -274,11 +276,12 @@ namespace pv
|
||||
assert(!_is_saving);
|
||||
assert(!_is_working);
|
||||
|
||||
dsv_info("Load file:\"%s\"", name.toUtf8().data());
|
||||
std::string file_name = pv::path::ToUnicodePath(name);
|
||||
dsv_info("Load file: \"%s\"", file_name.c_str());
|
||||
|
||||
std::string path = path::ToUnicodePath(name);
|
||||
std::string file_str = name.toUtf8().toStdString();
|
||||
|
||||
if (ds_device_from_file(path.c_str()) != SR_OK)
|
||||
if (ds_device_from_file(file_str.c_str()) != SR_OK)
|
||||
{
|
||||
dsv_err("%s", "Load file error!");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user