mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
If the file type wasn't recognized, check whether this failed because
of no read permission and give appropriate user feedback if yes. Feel free to adjust the wording. BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14791 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
2006-09-03 Christian Stimming <stimming@tuhh.de>
|
2006-09-03 Christian Stimming <stimming@tuhh.de>
|
||||||
|
|
||||||
|
* lib/libqof/qof/qofbackend.h, src/gnome-utils/gnc-file.c,
|
||||||
|
src/backend/file/gnc-backend-file.c: If the file type wasn't
|
||||||
|
recognized, check whether this failed because of no read
|
||||||
|
permission and give appropriate user feedback.
|
||||||
|
|
||||||
* src/backend/file/gnc-backend-file.c: Fix error checking for
|
* src/backend/file/gnc-backend-file.c: Fix error checking for
|
||||||
non-existing filenames. Will now always give a "file not found"
|
non-existing filenames. Will now always give a "file not found"
|
||||||
message on nonexisting paths or filenames. #351351.
|
message on nonexisting paths or filenames. #351351.
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ typedef enum {
|
|||||||
ERR_FILEIO_WRITE_ERROR, /**< couldn't write to the file */
|
ERR_FILEIO_WRITE_ERROR, /**< couldn't write to the file */
|
||||||
ERR_FILEIO_READ_ERROR, /**< Could not open the file for reading. */
|
ERR_FILEIO_READ_ERROR, /**< Could not open the file for reading. */
|
||||||
ERR_FILEIO_NO_ENCODING, /**< file does not specify encoding */
|
ERR_FILEIO_NO_ENCODING, /**< file does not specify encoding */
|
||||||
|
ERR_FILEIO_FILE_EACCES, /**< No read access permission for the given file */
|
||||||
|
|
||||||
/* network errors */
|
/* network errors */
|
||||||
ERR_NETIO_SHORT_READ = 2000, /**< not enough bytes received */
|
ERR_NETIO_SHORT_READ = 2000, /**< not enough bytes received */
|
||||||
|
|||||||
@@ -879,8 +879,24 @@ gnc_file_be_load_from_file (QofBackend *bend, QofBook *book)
|
|||||||
if (FALSE == rc) error = ERR_FILEIO_PARSE_ERROR;
|
if (FALSE == rc) error = ERR_FILEIO_PARSE_ERROR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PWARN("File not any known type");
|
/* If file type wasn't known, check errno again to give the
|
||||||
error = ERR_FILEIO_UNKNOWN_FILE_TYPE;
|
user some more useful feedback for some particular error
|
||||||
|
conditions. */
|
||||||
|
switch (errno)
|
||||||
|
{
|
||||||
|
case EACCES: /* No read permission */
|
||||||
|
PWARN("No read permission to file");
|
||||||
|
error = ERR_FILEIO_FILE_EACCES;
|
||||||
|
break;
|
||||||
|
case EISDIR: /* File is a directory - but on this error we don't arrive here */
|
||||||
|
PWARN("Filename is a directory");
|
||||||
|
error = ERR_FILEIO_FILE_NOT_FOUND;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PWARN("File not any known type");
|
||||||
|
error = ERR_FILEIO_UNKNOWN_FILE_TYPE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -443,6 +443,11 @@ show_session_error (QofBackendError io_error,
|
|||||||
gnc_error_dialog(parent, fmt, newfile);
|
gnc_error_dialog(parent, fmt, newfile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ERR_FILEIO_FILE_EACCES:
|
||||||
|
fmt = _("No read permission to read from file %s.");
|
||||||
|
gnc_error_dialog (parent, fmt, newfile);
|
||||||
|
break;
|
||||||
|
|
||||||
case ERR_SQL_DB_TOO_OLD:
|
case ERR_SQL_DB_TOO_OLD:
|
||||||
fmt = _("This database is from an older version of GnuCash. "
|
fmt = _("This database is from an older version of GnuCash. "
|
||||||
"Do you want to want to upgrade the database "
|
"Do you want to want to upgrade the database "
|
||||||
|
|||||||
Reference in New Issue
Block a user