diff --git a/tools/chatgui/src/main.cpp b/tools/chatgui/src/main.cpp index bf806583..71c69ca5 100644 --- a/tools/chatgui/src/main.cpp +++ b/tools/chatgui/src/main.cpp @@ -66,9 +66,10 @@ int main(int argc, char *argv[]) { } QString dbPath = cfg.dbPath(); - if (dbPath.isEmpty()) dbPath = "chats.db"; + if (dbPath.isEmpty()) dbPath = "chat_data"; if (!QDir::isAbsolutePath(dbPath)) dbPath = QCoreApplication::applicationDirPath() + "/" + dbPath; + QDir(dbPath).mkpath("."); DbManager db; MainWindow w(nullptr, &db, cfgPath, dbPath, cfg.debugFile(), diff --git a/tools/chatgui/transport/node_config.cpp b/tools/chatgui/transport/node_config.cpp index 42517edf..fc4383ca 100644 --- a/tools/chatgui/transport/node_config.cpp +++ b/tools/chatgui/transport/node_config.cpp @@ -175,7 +175,7 @@ bool NodeConfig::create(const QString& nodeName, quint16 listenPort) { if (listenPort > 0) m_servers.append({"lan", QString("0.0.0.0:%1").arg(listenPort)}); if (m_dbPath.isEmpty()) - m_dbPath = "chats.db"; + m_dbPath = "chat_data"; return save(); } @@ -340,7 +340,7 @@ bool NodeConfig::save() { } out << "[gui]\n"; - out << "db_path=" << (m_dbPath.isEmpty() ? "chats.db" : m_dbPath) << "\n"; + out << "db_path=" << (m_dbPath.isEmpty() ? "chat_data" : m_dbPath) << "\n"; out << "debug_file=" << m_debugFile << "\n"; out << "debug_level=" << (m_debugLevel.isEmpty() ? "info" : m_debugLevel) << "\n"; out << "debug_categories=" << m_debugCategories << "\n\n"; diff --git a/tools/chatgui/transport/utun_node.cpp b/tools/chatgui/transport/utun_node.cpp index 958e87e4..2998365d 100644 --- a/tools/chatgui/transport/utun_node.cpp +++ b/tools/chatgui/transport/utun_node.cpp @@ -1,6 +1,7 @@ // utun_node.cpp — embedded uTun node running in a dedicated thread #include "utun_node.h" #include +#include #include "../../lib/socket_compat.h" #include "../db/db_manager.h" @@ -62,6 +63,7 @@ void UtunNode::setDebugFile(const QString& path) { void UtunNode::setDbPath(const QString& path) { m_dbPath = path; + QDir(path).mkpath("."); } void UtunNode::setDebugLevel(const QString& level) { @@ -245,7 +247,7 @@ void UtunNode::runLoop() { etcp_router_bind(m_instance, ETCP_RT_ID_CHAT, recvCallback); /* Initialize chat_core (DB) and chat_sync (channel/message P2P sync) */ - chat_core_init(m_instance, m_dbPath.toUtf8().constData()); + chat_core_init(m_instance, QString(m_dbPath + "/chats.db").toUtf8().constData()); chat_sync_init(m_instance, nullptr); chat_sync_auto_connect_start(m_instance); DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "chat_core + chat_sync + auto_connect initialized");