diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-03-02 05:32:31 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-03-02 05:32:31 +0800 |
commit | 802b407b953c242977fd49c4fe78f0d4729f44f8 (patch) | |
tree | 9d528456a739b4d2e19109c464578b07c4781cfa /src/bookmarks/ephy-bookmarks.c | |
parent | f460e4b8e7ab36fc1deeb753a1ca8baa7d6116b8 (diff) | |
download | gsoc2013-epiphany-802b407b953c242977fd49c4fe78f0d4729f44f8.tar gsoc2013-epiphany-802b407b953c242977fd49c4fe78f0d4729f44f8.tar.gz gsoc2013-epiphany-802b407b953c242977fd49c4fe78f0d4729f44f8.tar.bz2 gsoc2013-epiphany-802b407b953c242977fd49c4fe78f0d4729f44f8.tar.lz gsoc2013-epiphany-802b407b953c242977fd49c4fe78f0d4729f44f8.tar.xz gsoc2013-epiphany-802b407b953c242977fd49c4fe78f0d4729f44f8.tar.zst gsoc2013-epiphany-802b407b953c242977fd49c4fe78f0d4729f44f8.zip |
Don't try to backup non-existing files :) Also, when neither
2004-03-01 Christian Persch <chpe@cvs.gnome.org>
* src/bookmarks/ephy-bookmarks.c: (backup_file),
(ephy_bookmarks_init):
Don't try to backup non-existing files :)
Also, when neither ephy-bookmarks.xml nor bookmarks.rdf exist,
assume we have a new profile and don't warn about missing bookmarks.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 88e9c5d65..d9a0f7b7d 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -591,6 +591,11 @@ backup_file (const char *original_filename, const char *extension) char *template, *backup_filename; int result = 0; + if (g_file_test (original_filename, G_FILE_TEST_EXISTS) == FALSE) + { + return; + } + template = g_strconcat (original_filename, ".backup-XXXXXX", NULL); backup_filename = ephy_file_tmp_filename (template, extension); @@ -706,9 +711,14 @@ ephy_bookmarks_init (EphyBookmarks *eb) eb->priv->smartbookmarks = ephy_node_new_with_id (db, SMARTBOOKMARKS_NODE_ID); ephy_node_ref (eb->priv->smartbookmarks); - if (ephy_node_db_load_from_file (eb->priv->db, eb->priv->xml_file, - EPHY_BOOKMARKS_XML_ROOT, - EPHY_BOOKMARKS_XML_VERSION) == FALSE) + if (g_file_test (eb->priv->xml_file, G_FILE_TEST_EXISTS) == FALSE + && g_file_test (eb->priv->rdf_file, G_FILE_TEST_EXISTS) == FALSE) + { + eb->priv->init_defaults = TRUE; + } + else if (ephy_node_db_load_from_file (eb->priv->db, eb->priv->xml_file, + EPHY_BOOKMARKS_XML_ROOT, + EPHY_BOOKMARKS_XML_VERSION) == FALSE) { /* save the corrupted files so the user can late try to * manually recover them. See bug #128308. |