From c1a612b7ec539c2000ac8813aedf521e61d50958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sun, 11 Mar 2012 18:02:54 +0100 Subject: [PATCH] Fix BDD path (Linux and Win32) --- README | 2 +- README.fr | 2 +- src/model/Database.cpp | 4 ++-- src/model/Database.hpp | 6 ++++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README b/README index 83d3a2e..8c8a8aa 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ KissCount is personnal account software delivered under GPL v3 licence terms. Current version is 0.3 -Qt4 (>= 4.7), libqt4-sql-sqlite and libofx (Linux only) are needed +Qt4 (>= 4.7), libqt4-sql-sqlite and libofx are needed (Linux only) If you use web view, edit database.php and set $BDD_FILE, it's higly recommanded to use an SSL certificate. diff --git a/README.fr b/README.fr index 38111a6..1f41140 100644 --- a/README.fr +++ b/README.fr @@ -2,7 +2,7 @@ KissCount est un logiciel de gestion de comptes personnels délivré sous licenc La version actuelle est 0.3 -Qt4 (>= 4.7), libqt4-sql-sqlite et libofx (Uniquement pour Linux) sont nécessaires +Qt4 (>= 4.7), libqt4-sql-sqlite et libofx sont nécessaires (Uniquement pour Linux) Si vous utilisez la version web pour visualiser vos comptes, éditez d'abord le fichier database.php en positionnant correctement la variable $BDD_FILE, il est fortement recommandé d'utiliser un certificat SSL. diff --git a/src/model/Database.cpp b/src/model/Database.cpp index 94406b9..72b5070 100644 --- a/src/model/Database.cpp +++ b/src/model/Database.cpp @@ -44,7 +44,7 @@ Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss) { std::ifstream bdd_file; - QString sPath = QDir::home().path() + "/.local/share/kisscount/" + BDD_FILE; + QString sPath = QDir::home().path() + BDD_PATH + BDD_FILE; _db = QSqlDatabase::addDatabase("QSQLITE"); @@ -96,7 +96,7 @@ void Database::CreateDatabase() { QFile init_script(INIT_SCRIPT); QString sPath = QDir::home().path() + BDD_FILE; - QDir dirname( QDir::home().path() + "/.kisscount/"); + QDir dirname( QDir::home().path() + BDD_PATH); QFile file(sPath); QString message = _("No database found, would you like to create a new one ?\n\n"); message += _("!! Warning !! If there was a bug, the old database will be suppressed !"); diff --git a/src/model/Database.hpp b/src/model/Database.hpp index c80715c..d17673e 100644 --- a/src/model/Database.hpp +++ b/src/model/Database.hpp @@ -28,7 +28,13 @@ #include #include "model.hpp" +#ifdef WIN32 +#define BDD_PATH "/" // In home directory (C:\Documents and settings\UserX\) +#else +#define BDD_PATH "/.local/share/kisscount/" +#endif #define BDD_FILE "kc.bdd" + #define INIT_SCRIPT RESSOURCES_ROOT "init.sql"