diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-02-11 20:46:07 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-02-11 20:46:07 (GMT) |
commit | 2b2580b29b1ea039eaffd85fd3caea4c0e6d648d (patch) | |
tree | 5089799afd3bec10c5a92d7367d5487216e5406c | |
parent | a25256dd074fd333a53c12ffca874cb731ccecf3 (diff) |
*** RELEASE 7.3RC1 ***
* configure.in:
* src/gcompris/gcompris_db.c: (gcompris_db_init): patch by Yves from 7.4 branch to remove sqlite
database if it is empty.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | src/gcompris/gcompris_db.c | 16 |
3 files changed, 25 insertions, 1 deletions
@@ -1,3 +1,11 @@ + *** RELEASE 7.3RC1 *** + +2006-02-11 Bruno coudoin <bruno.coudoin@free.fr> + + * configure.in: + * src/gcompris/gcompris_db.c: (gcompris_db_init): patch by Yves from 7.4 branch to remove sqlite + database if it is empty. + 2006-02-11 Bruno coudoin <bruno.coudoin@free.fr> New icons from Franck Doucet. diff --git a/configure.in b/configure.in index 8dfe696..e047caf 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(src/gcompris/gcompris.c) AC_CANONICAL_TARGET -AM_INIT_AUTOMAKE(gcompris, 7.29) +AM_INIT_AUTOMAKE(gcompris, 7.3RC1) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE diff --git a/src/gcompris/gcompris_db.c b/src/gcompris/gcompris_db.c index 5462588..eb10aa5 100644 --- a/src/gcompris/gcompris_db.c +++ b/src/gcompris/gcompris_db.c @@ -20,6 +20,8 @@ #include <string.h> #include "gcompris.h" +#include <sys/stat.h> + #ifdef USE_SQLITE static sqlite3 *gcompris_db=NULL; @@ -128,7 +130,21 @@ int gcompris_db_init() if (!g_file_test(properties->database, G_FILE_TEST_EXISTS)) creation = TRUE; + else { + /* we have to check this file is not empty, + because bug in administration */ + struct stat buf; + + if (stat(properties->database, &buf)!=0) + g_error("Can't stat %s", properties->database); + /* if size of file is null, we recreate the tables */ + if (buf.st_size == 0){ + creation = TRUE; + g_warning("Database file is empty! Trying to create table..."); + } + } + rc = sqlite3_open(properties->database, &gcompris_db); if( rc ){ g_error("Can't open database: %s\n", sqlite3_errmsg(gcompris_db)); |