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


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14865 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler 2006-09-19 00:52:54 +00:00
parent db00d6a259
commit 296f730165
3 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2006-09-19 Andreas Köhler <andi5.py@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@tuhh.de>
* src/engine/binreloc.[hc], src/engine/gnc-path.c,

View File

@ -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);

View File

@ -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))