修复路径问题

1. 配置文件创建在程序所在目录;
2. csv文件(ximea温度)输出路径改为:/home/programRunLog/hyperspectralLog;
This commit is contained in:
tangchao0503
2022-10-09 23:00:15 +08:00
parent c35568bb2e
commit 374a48022b
4 changed files with 18 additions and 6 deletions

View File

@ -159,7 +159,6 @@ bool Configfile::createConfigFile()
using namespace std;
using namespace libconfig;
static const char *output_file = "ximea.cfg";
Config cfg;
Setting &root = cfg.getRoot();
@ -208,15 +207,16 @@ bool Configfile::createConfigFile()
// Write out the new configuration.
QString output_file = QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() + "ximea.cfg");
try
{
cfg.writeFile(output_file);
cerr << "New configuration successfully written to: " << output_file << endl;
cfg.writeFile(output_file.toStdString().c_str());
cerr << "New configuration successfully written to: " << output_file.toStdString().c_str() << endl;
}
catch(const FileIOException &fioex)
{
cerr << "I/O error while writing configuration file: " << output_file << endl;
cerr << "I/O error while writing configuration file: " << output_file.toStdString().c_str() << endl;
return true;
}