diff --git a/ChangeLog b/ChangeLog index dd9599bb4d..378ce64530 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-09-19 Andreas Köhler + + * 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 * src/engine/binreloc.[hc], src/engine/gnc-path.c, diff --git a/src/backend/file/gnc-backend-file.c b/src/backend/file/gnc-backend-file.c index 24987829f0..a673726a77 100644 --- a/src/backend/file/gnc-backend-file.c +++ b/src/backend/file/gnc-backend-file.c @@ -230,7 +230,7 @@ file_session_begin(QofBackend *be_start, QofSession *session, /* 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); diff --git a/src/gnome-utils/gnc-file.c b/src/gnome-utils/gnc-file.c index 73d10846cf..7baab9e716 100644 --- a/src/gnome-utils/gnc-file.c +++ b/src/gnome-utils/gnc-file.c @@ -416,8 +416,12 @@ show_session_error (QofBackendError io_error, 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 @@ gnc_file_save_as (void) } /* 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))