2001-05-14 Dave Peticolas <dave@krondo.com>

* src/engine/gnc-book.c (gnc_book_begin_file): check for missing
	directory

	* src/gnome/file-history.c (gnc_history_add_file): fix bug


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4189 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-05-14 08:38:24 +00:00
parent cf175242d6
commit d90446e3d5
2 changed files with 40 additions and 0 deletions

View File

@ -570,6 +570,9 @@ static gboolean
gnc_book_begin_file (GNCBook *book, const char * filefrag,
gboolean ignore_lock)
{
char *dirname;
char *p;
ENTER (" filefrag=%s", filefrag ? filefrag : "(null)");
/* Try to find or build an absolute file path */
@ -581,6 +584,28 @@ gnc_book_begin_file (GNCBook *book, const char * filefrag,
return FALSE; /* ouch */
}
/* Make sure the directory is there */
dirname = g_strdup (book->fullpath);
p = strrchr (dirname, '/');
if (p && p != dirname)
{
struct stat statbuf;
int rc;
*p = '\0';
rc = stat (dirname, &statbuf);
if (rc != 0 || !S_ISDIR(statbuf.st_mode))
{
gnc_book_push_error (book, ERR_FILEIO_FILE_NOT_FOUND, NULL);
g_free (book->fullpath); book->fullpath = NULL;
g_free (dirname);
return FALSE;
}
}
g_free (dirname);
/* Store the sessionid URL also ... */
book->book_id = g_strconcat ("file:", filefrag, NULL);

View File

@ -138,6 +138,21 @@ gnc_history_add_file(const char *newfile)
history_list = new_list;
__gnc_history_config_write();
/* Update apps immediately */
{
GList *containers = gtk_container_get_toplevels ();
while (containers)
{
GtkWidget *w = containers->data;
if (GNOME_IS_APP (w))
gnc_history_update_menu (GNOME_APP(w));
containers = containers->next;
}
}
}
const char *