mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-02-02 13:52:55 +08:00
fix: unable to create log directory
This commit is contained in:
parent
0d13901cbb
commit
00c853de31
@ -67,6 +67,14 @@ void dsv_log_enalbe_logfile(bool append)
|
||||
|
||||
dsv_info("%s\"%s\"", "Store log to file: ", lf.toUtf8().data());
|
||||
|
||||
QFileInfo fileInfo(lf);
|
||||
QString file_dir = fileInfo.absolutePath();
|
||||
|
||||
QDir dir;
|
||||
if (!dir.exists(file_dir) && !dir.mkpath(file_dir)){
|
||||
dsv_err("ERROR: failed to create log directory.");
|
||||
}
|
||||
|
||||
std::string log_file = pv::path::ToUnicodePath(lf);
|
||||
|
||||
int ret = xlog_add_receiver_from_file(log_ctx, log_file.c_str(), &log_file_index, append);
|
||||
@ -133,4 +141,4 @@ QString get_dsv_log_path()
|
||||
#endif
|
||||
|
||||
return lf;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user