AUDIT: r14865 - gnucash/trunk - Do not complain about non-existent files if we save to a new file. In

Andreas Köhler andi5 at cvs.gnucash.org
Mon Sep 18 20:52:55 EDT 2006


Author: andi5
Date: 2006-09-18 20:52:54 -0400 (Mon, 18 Sep 2006)
New Revision: 14865
Trac: http://svn.gnucash.org/trac/changeset/14865

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/backend/file/gnc-backend-file.c
   gnucash/trunk/src/gnome-utils/gnc-file.c
Log:
Do not complain about non-existent files if we save to a new file. In
pass one we ignore the error returned by stat and call qof_session_begin
with create_if_nonexistent=TRUE for a second run.
BP


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-09-18 20:58:01 UTC (rev 14864)
+++ gnucash/trunk/ChangeLog	2006-09-19 00:52:54 UTC (rev 14865)
@@ -1,3 +1,11 @@
+2006-09-19  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/backend/file/gnc-backend-file.c:
+	* src/gnome-utils/gnc-file.c: Do not complain about non-existent
+	  files if we save to a new file. In pass one we ignore the error
+	  returned by stat and call qof_session_begin with
+	  create_if_nonexistent=TRUE for a second run.
+
 2006-09-18  Christian Stimming  <stimming at tuhh.de>
 
 	* src/engine/binreloc.[hc], src/engine/gnc-path.c,

Modified: gnucash/trunk/src/backend/file/gnc-backend-file.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-backend-file.c	2006-09-18 20:58:01 UTC (rev 14864)
+++ gnucash/trunk/src/backend/file/gnc-backend-file.c	2006-09-19 00:52:54 UTC (rev 14865)
@@ -230,7 +230,7 @@
 
 	/* Now check whether we can stat(2) the file itself */
         rc = stat (be->fullpath, &statbuf);
-        if (rc != 0)
+        if ((rc != 0) && (!create_if_nonexistent))
         {
 	    /* Error on stat means the file doesn't exist */
             qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);

Modified: gnucash/trunk/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-file.c	2006-09-18 20:58:01 UTC (rev 14864)
+++ gnucash/trunk/src/gnome-utils/gnc-file.c	2006-09-19 00:52:54 UTC (rev 14865)
@@ -416,8 +416,12 @@
       break;
 
     case ERR_FILEIO_FILE_NOT_FOUND:
-      fmt = _("The file %s could not be found.");
-      gnc_error_dialog (parent, fmt, newfile);
+      if (type == GNC_FILE_DIALOG_SAVE) {
+        uh_oh = FALSE;
+      } else {
+        fmt = _("The file %s could not be found.");
+        gnc_error_dialog (parent, fmt, newfile);
+      }
       break;
 
     case ERR_FILEIO_FILE_TOO_OLD:
@@ -1068,7 +1072,8 @@
   }
 
   /* if the database doesn't exist, ask the user ... */
-  else if ((ERR_BACKEND_NO_SUCH_DB == io_err) ||
+  else if ((ERR_FILEIO_FILE_NOT_FOUND == io_err) ||
+           (ERR_BACKEND_NO_SUCH_DB == io_err) ||
            (ERR_SQL_DB_TOO_OLD == io_err))
   {
     if (FALSE == show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE))



More information about the gnucash-changes mailing list