chatgui: пути db и лога относительные в конфиге, резолв к бинарнику в рантайме

This commit is contained in:
evgeny committed 2026-09-04 14:34:39 +03:00
1 parent 654202b0cb
commit d092f649ac
2 files changed
+1 -11

No files matched your search

+1 -9
View File
@@ -130,22 +130,14 @@ int main(int argc, char *argv[]) {
if (!QDir::isAbsolutePath(dbPath))
dbPath = QCoreApplication::applicationDirPath() + "/" + dbPath;
QDir(dbPath).mkpath(".");
if (cfg.dbPath() != dbPath) {
cfg.setDbPath(dbPath);
cfg.save();
}
QString debugFile = cfg.debugFile();
if (debugFile.isEmpty()) debugFile = "chatgui.log";
if (!QDir::isAbsolutePath(debugFile))
debugFile = QCoreApplication::applicationDirPath() + "/" + debugFile;
if (cfg.debugFile() != debugFile) {
cfg.setDebugFile(debugFile);
cfg.save();
}
DbManager db;
MainWindow w(nullptr, &db, cfgPath, dbPath, cfg.debugFile(),
MainWindow w(nullptr, &db, cfgPath, dbPath, debugFile,
cfg.debugLevel(), cfg.debugCategories());
w.show();
-2
View File
@@ -358,7 +358,6 @@ bool NodeConfig::saveFull() {
if (!m_privKey.isEmpty()) out << "my_private_key=" << m_privKey << "\n";
if (!m_pubKey.isEmpty()) out << "my_public_key=" << m_pubKey << "\n";
out << "auto_sockets=" << (m_autoSockets ? "yes" : "no") << "\n";
out << "db_path=" << (m_dbPath.isEmpty() ? "chat_data" : m_dbPath) << "\n";
out << "\n";
for (auto& srv : m_servers) {
@@ -433,7 +432,6 @@ bool NodeConfig::save() {
config_update_in_lines(lines, "global", "my_private_key", m_privKey, true);
config_update_in_lines(lines, "global", "my_public_key", m_pubKey, true);
config_update_in_lines(lines, "global", "auto_sockets", m_autoSockets ? "yes" : "no", true);
config_update_in_lines(lines, "global", "db_path", m_dbPath.isEmpty() ? "chat_data" : m_dbPath, true);
if (!m_controlAddr.isEmpty()) {
int sep = m_controlAddr.lastIndexOf(':');