[libgda] Corrected bug introduced in commit #8b6ea1ec34f45383e7035d7f8748e45dc716d2dd



commit aa8fbb0d1e94cba3624fcb2429e729b294c4b9ce
Author: Vivien Malerba <malerba gnome-db org>
Date:   Thu Sep 1 19:57:49 2011 +0200

    Corrected bug introduced in commit #8b6ea1ec34f45383e7035d7f8748e45dc716d2dd

 libgda/sqlite/gda-sqlite-provider.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/libgda/sqlite/gda-sqlite-provider.c b/libgda/sqlite/gda-sqlite-provider.c
index 7b7b7de..afeab3c 100644
--- a/libgda/sqlite/gda-sqlite-provider.c
+++ b/libgda/sqlite/gda-sqlite-provider.c
@@ -820,14 +820,25 @@ gda_sqlite_provider_open_connection (GdaServerProvider *provider, GdaConnection
 			}
 
 			/* try first with the file extension */
-			gchar *tmp;
+			gchar *tmp, *f1, *f2;
 			tmp = g_strdup_printf ("%s%s", dbname, FILE_EXTENSION);
-			filename = g_build_filename (dirname, tmp, NULL);
+			f1 = g_build_filename (dirname, tmp, NULL);
 			g_free (tmp);
-			if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
-				g_free (filename);
-				filename = g_build_filename (dirname, dbname, NULL);
+			f2 = g_build_filename (dirname, dbname, NULL);
+			if (g_file_test (f1, G_FILE_TEST_EXISTS)) {
+				filename = f1;
+				f1 = NULL;
 			}
+			else if (g_file_test (f2, G_FILE_TEST_EXISTS)) {
+				filename = f2;
+				f2 = NULL;
+			}
+			else {
+				filename = f1;
+				f1 = NULL;
+			}
+			g_free (f1);
+			g_free (f2);
 			g_free (dup);
 		}
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]