Fix BDD path (Linux and Win32)

This commit is contained in:
Grégory Soutadé 2012-03-11 18:02:54 +01:00
parent e4ec79b9df
commit c1a612b7ec
4 changed files with 10 additions and 4 deletions

2
README
View File

@ -2,7 +2,7 @@ KissCount is personnal account software delivered under GPL v3 licence terms.
Current version is 0.3 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. If you use web view, edit database.php and set $BDD_FILE, it's higly recommanded to use an SSL certificate.

View File

@ -2,7 +2,7 @@ KissCount est un logiciel de gestion de comptes personnels délivré sous licenc
La version actuelle est 0.3 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. 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.

View File

@ -44,7 +44,7 @@ Database::Database(const char* filename, KissCount* kiss) : _kiss(kiss)
{ {
std::ifstream bdd_file; 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"); _db = QSqlDatabase::addDatabase("QSQLITE");
@ -96,7 +96,7 @@ void Database::CreateDatabase()
{ {
QFile init_script(INIT_SCRIPT); QFile init_script(INIT_SCRIPT);
QString sPath = QDir::home().path() + BDD_FILE; QString sPath = QDir::home().path() + BDD_FILE;
QDir dirname( QDir::home().path() + "/.kisscount/"); QDir dirname( QDir::home().path() + BDD_PATH);
QFile file(sPath); QFile file(sPath);
QString message = _("No database found, would you like to create a new one ?\n\n"); 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 !"); message += _("!! Warning !! If there was a bug, the old database will be suppressed !");

View File

@ -28,7 +28,13 @@
#include <controller/KissCount.hpp> #include <controller/KissCount.hpp>
#include "model.hpp" #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 BDD_FILE "kc.bdd"
#define INIT_SCRIPT RESSOURCES_ROOT "init.sql" #define INIT_SCRIPT RESSOURCES_ROOT "init.sql"