更改设备配置文件路径,与界面配置文件路径保持一致

This commit is contained in:
gb 2022-06-02 11:47:17 +08:00
parent 7196fe94c9
commit 803c57c0ee
1 changed files with 8 additions and 3 deletions

View File

@ -11,6 +11,8 @@
#include <qtextcodec.h>
#include <string.h>
#include <QCoreApplication>
#include "base/HGUtility.h"
config::config() : ini_(NULL), file_(""), schem_jsn_(NULL)
{
@ -195,13 +197,16 @@ int config::load(QString file)
ini_ = NULL;
if(file.length() == 0)
file = "configs/scanner.conf";
file = "scanner.conf";
file_ = file;
if(file_[0] != '/')
{
file_ = config::self_path();
file_ += "/" + file;
HGChar logpath[512] = {0};
HGBase_GetConfigPath(logpath, sizeof(logpath) / sizeof(logpath[0]) - 1);
file_ = logpath;
file_ += file;
}
ini_ = new QSettings(file_, QSettings::IniFormat);
ini_->setIniCodec(QTextCodec::codecForName("UTF-8"));