From d0adbe77b723242366a5098fc7b5094a8f3d9bd4 Mon Sep 17 00:00:00 2001
From: jonymt <johanmt@yandex.ru>
Date: Thu, 19 Sep 2019 12:44:46 +0200
Subject: [PATCH] [*] added creation dir for cmd log

---
 CellFrameDashboardService/CellFrameDashboardService.pro | 2 ++
 CellFrameDashboardService/DapChainConsoleHandler.cpp    | 3 ++-
 CellFrameDashboardService/DapChainConsoleHandler.h      | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/CellFrameDashboardService/CellFrameDashboardService.pro b/CellFrameDashboardService/CellFrameDashboardService.pro
index 3e2af3a75..8a9b10ba3 100755
--- a/CellFrameDashboardService/CellFrameDashboardService.pro
+++ b/CellFrameDashboardService/CellFrameDashboardService.pro
@@ -22,11 +22,13 @@ win32 {
     VERSION = $${VER_MAJ}.$${VER_MIN}.$$VER_PAT
     DEFINES += CLI_PATH=\\\"./kelvin-node-cli.exe\\\"
     DEFINES += LOG_FILE=\\\"./opt/cellframe-node/var/log/cellframe-node_logs.txt\\\"
+    DEFINES += CMD_LOG=\\\"./opt/cellframe-dashboard/data/cellframe-cmd_log.txt\\\"
 }
 else {
     VERSION = $$VER_MAJ\.$$VER_MIN\-$$VER_PAT
     DEFINES += CLI_PATH=\\\"/opt/cellframe-node/bin/cellframe-node-cli\\\"
     DEFINES += LOG_FILE=\\\"/opt/cellframe-node/var/log/cellframe-node_logs.txt\\\"
+    DEFINES += CMD_LOG=\\\"/opt/cellframe-dashboard/data/cellframe-cmd_log.txt\\\"
 }
 
 # The following define makes your compiler emit warnings if you use
diff --git a/CellFrameDashboardService/DapChainConsoleHandler.cpp b/CellFrameDashboardService/DapChainConsoleHandler.cpp
index c13b20ac7..c65b2aa34 100644
--- a/CellFrameDashboardService/DapChainConsoleHandler.cpp
+++ b/CellFrameDashboardService/DapChainConsoleHandler.cpp
@@ -4,7 +4,8 @@
 
 DapChainConsoleHandler::DapChainConsoleHandler(QObject *parent) : QObject(parent)
 {
-    m_File = new QFile("cmd_log.txt", this);
+    QDir().mkpath(QFileInfo(CMD_LOG).path());
+    m_File = new QFile(CMD_LOG, this);
     m_File->open(QIODevice::Append | QIODevice::ReadWrite);
 }
 
diff --git a/CellFrameDashboardService/DapChainConsoleHandler.h b/CellFrameDashboardService/DapChainConsoleHandler.h
index 907c47e6b..faaced1aa 100644
--- a/CellFrameDashboardService/DapChainConsoleHandler.h
+++ b/CellFrameDashboardService/DapChainConsoleHandler.h
@@ -5,6 +5,7 @@
 #include <QProcess>
 #include <QDebug>
 #include <QFile>
+#include <QDir>
 
 class DapChainConsoleHandler : public QObject
 {
-- 
GitLab